1
0
mirror of https://github.com/veden/Rampant.git synced 2025-01-28 03:29:34 +02:00

FACTO-13: Fixed chunkPack nil on processNest

This commit is contained in:
Aaron Veden 2022-01-14 11:17:33 -08:00
parent af6ee77dba
commit 28b40203e6
No known key found for this signature in database
GPG Key ID: FF5990B1C6DD3F84
3 changed files with 19 additions and 2 deletions

View File

@ -6,6 +6,7 @@ Date: 29. 12. 2021
Tweaks:
- Set maximum value on enemy seed to 4294967295
Bugfixes:
- Fixed chunkPack nil in processNests (Thanks Skallywaggz for the report)
- Fixed random generator seed overflow (Thanks NeveHanter for the report)
- Fixed removing chunks could index outside processQueueLength (Thanks thecheat789 for the report)
- Fixed processMap and processStaticMap could index outside processQueueLength

View File

@ -46,6 +46,8 @@ local BASE_PROCESS_INTERVAL = constants.BASE_PROCESS_INTERVAL
-- imported functions
local removeChunkToNest = mapUtils.removeChunkToNest
local processStaticPheromone = pheromoneUtils.processStaticPheromone
local processPheromone = pheromoneUtils.processPheromone
@ -452,7 +454,7 @@ function mapProcessor.processNests(universe, tick)
universe.processNestIterator = next(universe.chunkToNests, chunkId)
local map = chunkPack.map
if not map.surface.valid then
universe.chunkToNests[chunkId] = nil
removeChunkToNest(universe, chunkId)
return
end
local chunk = getChunkById(map, chunkId)
@ -482,7 +484,11 @@ local function processSpawnersBody(universe, iterator, chunks)
universe[iterator] = next(chunks, chunkId)
local map = chunkPack.map
if not map.surface.valid then
chunks[chunkId] = nil
if (iterator == "processMigrationIterator") then
removeChunkToNest(universe, chunkId)
else
chunks[chunkId] = nil
end
return
end
local state = chunkPack.map.state

View File

@ -76,6 +76,16 @@ function mapUtils.nextMap(universe)
until mapIterator == universe.mapIterator
end
function mapUtils.removeChunkToNest(universe, chunkId)
universe.chunkToNests[chunkId] = nil
if (chunkId == universe.processNestIterator) then
universe.processNestIterator = nil
end
if (chunkId == universe.processMigrationIterator) then
universe.processNestIterator = nil
end
end
function mapUtils.removeChunkFromMap(map, x, y, chunkId)
local universe = map.universe
map[x][y] = nil