Skip to content

Crash due to QueuedSpawn entry without location #228

@Lemonymous

Description

@Lemonymous

Doing a little bit of ITB modding, and getting a strange error.

No matching overload found, candidates:
bool IsSpawning(Board&,Point)

Narrowed it down to mod_loader/altered/missions.lua:31

for i = #self.QueuedSpawns, 1, -1 do
	local spawn = self.QueuedSpawns[i]

	if not Board:IsSpawning(spawn.location) then
		table.remove(self.QueuedSpawns, i)
		table.insert(removed, spawn)
	end
end

Added a LOG to mod_loader/altered/missions.lua:30:

LOG("Mission:UpdateQueuedSpawns", i, spawn.location, spawn, save_table(spawn))

Output: (missing location)

Mission:UpdateQueuedSpawns 2 nil table: 1551FCD8 { 
["id"] = 2111, 
["turns"] = 0, 
["type"] = "Firefly1" 
}

Added a LOG to mod_loader/altered/spawn_point.lua:41:

local function addSpawnData(self, location, type, id, age)
	LOG("addSpawnData", self, location, type, id, age)
	if location == nil then
		LOG("WARNING", debug.traceback())
	end

Output:

addSpawnData table: 28B8CB40
WARNING stack traceback:
    ./scripts/mod_loader/altered/spawn_point.lua:44: in function 'addSpawnData'
    ./scripts/mod_loader/altered/spawn_point.lua:112: in function 'SpawnPawn'
    ./scripts/mod_loader/altered/spawn_point.lua:120: in function 'hook'
    ./scripts/mod_loader/modapi/hooks.lua:118: in function 'updateScheduledHooks'
    ./scripts/mod_loader/modapi/init.lua:131: in function <./scripts/mod_loader/modapi/init.lua:124>
    (tail call): ?
    [C]: in function 'pcall'
    ./scripts/mod_loader/bootstrap/event.lua:56: in function 'notify'
    ./scripts/mod_loader/bootstrap/event.lua:236: in function 'dispatch'
    ./scripts/mod_loader/modui/root.lua:312: in function <./scripts/mod_loader/modui/root.lua:226>

It shouldn't be possible to add a spawn point without a location, so not quite sure what the issue is.
This happened while working on memedit, with only memedit enabled, during a memedit scan.

Not sure if it was related or not. I have a save state where I can reproduce the issue.
Steps:

1. Delete __addresses.lua from memedit so that it can be calibrated again
2. Alter memedit/scanner/scanner.lua as specified below
3. Start game with only memedit enabled
4. Continue game, or use "undoturn" to load it
5. Start memedit calibration
6. Press End Turn as prompted
7. Game will crash during the enemy turn, during spawning

Altered memedit/scanner/scanner.lua

-- this is basically just a reduced scan, with most of the scans commented out.
Scanner.scandefs = {
	vital = require(path.."vital"),
	-- pawn = require(path.."pawn"),
	-- weapon = require(path.."weapon"),
	board = require(path.."board"),
	-- tile = require(path.."tile"),
	-- game = require(path.."game"),
	-- spaceDamage = require(path.."spaceDamage"),
}

Save files: (renamed .txt to allow for upload)
modcontent.lua.txt
profile.lua.txt
saveData.lua.txt
undoSave.lua.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions