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
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/snippets/fix.6609.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- (#6609) Fix drones meant to rebuild unbuilt units during unit transfer not being cleaned up when rebuilding fails.
4 changes: 2 additions & 2 deletions lua/SimUtils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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.

for k, tracker in trackers do
if tracker.Success then
continue
end
Expand All @@ -555,7 +555,7 @@ function TryRebuildUnits(trackers, army)

WaitTicks(1)

for k, rebuilder in ipairs(rebuilders) do
for k, rebuilder in rebuilders do
local tracker = trackers[k]
local newUnit = rebuilder:GetFocusUnit()
local progressDif = rebuilder:GetWorkProgress() - tracker.UnitProgress
Expand Down
Loading