Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix drones used in unit transfer to rebuild units not being destroyed #6609

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

lL1l1
Copy link
Contributor

@lL1l1 lL1l1 commented Jan 2, 2025

Description of the proposed changes

Fixes a bug reported in Discord and shown in replay 23962051 where rebuilder drones were not getting cleaned up after use.
This is caused by the rebuilders table being indexed by the index of trackers, but this indexing can be skipped if trackers.success is true, which causes ipairs to not completely iterate over rebuilders, causing some rebuilder drones to not be destroyed.

Testing done on the proposed changes

Launch replay 23962051 from the branch deploy/faf at commit 805bdd3 with the logging commit cherrypicked on top. It will take around 11 minutes in-game for the bug to show, so you can use wld_RunWithTheWind.
The log will show that the tracker with the 2nd index fails, which causes the next iteration of rebuilders (for the next army) to create a rebuilder for tracker 2, but it doesn't iterate over rebuilders = {[1] = nil, [2] = rebuilder}, so rebuilder 2 is not destroyed.

By adding in the commits that remove the ipairs iterators, the same replay shows that the rebuilders are all destroyed every army iteration despite tracker 2 failing.

Checklist

- [ ] Changes are annotated, including comments where useful

  • Changes are documented in the changelog for the next game version

lL1l1 added 3 commits January 1, 2025 17:26
Use with replay 23962051 to see drones not being cleaned up
@lL1l1 lL1l1 added type: bug area: sim Area that is affected by the Simulation of the Game labels Jan 2, 2025
@lL1l1 lL1l1 added this to the Development Iteration I of 2025 milestone Jan 2, 2025
@lL1l1 lL1l1 marked this pull request as ready for review January 2, 2025 01:39
@@ -533,7 +533,7 @@ end
---@param army Army
function TryRebuildUnits(trackers, army)
local rebuilders = {}
for k, tracker in ipairs(trackers) do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this affect the outcome? The trackers are still created using ipairs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't, I just removed it for consistent code style.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: sim Area that is affected by the Simulation of the Game type: bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants