diff --git a/changelog.txt b/changelog.txt index 323749b..d7a8cee 100644 --- a/changelog.txt +++ b/changelog.txt @@ -18,6 +18,7 @@ Date: 23. 11. 2021 - 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 + - Fixed enemy destroying a player structure only processing half of the chunks it should have been --------------------------------------------------------------------------------------------------- Version: 1.1.4 diff --git a/libs/PheromoneUtils.lua b/libs/PheromoneUtils.lua index d2ffe91..6c0bec5 100644 --- a/libs/PheromoneUtils.lua +++ b/libs/PheromoneUtils.lua @@ -63,11 +63,18 @@ function pheromoneUtils.victoryScent(map, chunk, entityType) end function pheromoneUtils.disperseVictoryScent(map) - local iterator = map.victoryScentIterator + local chunk = map.victoryScentIterator local chunkToVictory = map.chunkToVictory - - local chunk,pheromone = next(chunkToVictory, iterator) - if chunk then + local pheromone + if not chunk then + chunk, pheromone = next(chunkToVictory, nil) + else + pheromone = chunkToVictory[chunk] + end + if not chunk then + map.victoryScentIterator = nil + else + map.victoryScentIterator = next(chunkToVictory, chunk) local chunkX = chunk.x local chunkY = chunk.y local i = 1 @@ -81,12 +88,8 @@ function pheromoneUtils.disperseVictoryScent(map) end end - local newChunk = next(chunkToVictory, chunk) chunkToVictory[chunk] = nil - chunk = newChunk end - - map.victoryScentIterator = chunk end function pheromoneUtils.deathScent(map, chunk)