1
0
mirror of https://github.com/veden/Rampant.git synced 2024-12-28 21:08:22 +02:00

fixed squad cleanup periodically skipping groups

This commit is contained in:
Aaron Veden 2021-11-25 10:08:35 -08:00
parent a35e0bc031
commit c217a8f82d
No known key found for this signature in database
GPG Key ID: FF5990B1C6DD3F84
2 changed files with 10 additions and 7 deletions

View File

@ -17,6 +17,7 @@ Date: 23. 11. 2021
- Fixed new enemy building upgrade could replace an entity with the same entity (Thank you Dimm2101)
- Fixed new enemy regional base recycling would only process half the bases
- Fixed new enemy adaptation due to damage type not correctly calculating probability for adaptation
- Fixed squad cleanup would periodically skip a squad when cleaning up dead unit groups
---------------------------------------------------------------------------------------------------
Version: 1.1.4

View File

@ -322,15 +322,21 @@ end
function squadAttack.cleanSquads(map)
local squads = map.groupNumberToSquad
local iterator = map.squadIterator
local k, squad = next(squads, iterator)
local k = map.squadIterator
local squad
if not k then
k, squad = next(squads, k)
else
squad = squads[k]
end
if not k then
map.squadIterator = nil
if (table_size(squads) == 0) then
-- this is needed as the next command remembers the max length a table has been
map.groupNumberToSquad = {}
end
else
map.squadIterator = next(squads, k)
local group = squad.group
if not group.valid then
addDeathGenerator(map, squad.chunk, FIVE_DEATH_PHEROMONE_GENERATOR_AMOUNT)
@ -344,15 +350,11 @@ function squadAttack.cleanSquads(map)
else
universe.squadCount = universe.squadCount - 1
end
local nextK
nextK = next(squads, k)
squads[k] = nil
k = nextK
elseif (group.state == 4) then
squadAttack.squadDispatch(map, squad)
end
end
map.squadIterator = k
end
function squadAttack.squadDispatch(map, squad)