don't use cached iterators across map reloads

develop
myk002 2020-11-12 00:11:13 -08:00
parent 923b1b14f3
commit 36110902fa
No known key found for this signature in database
GPG Key ID: 8A39CA0FA0C16E78
1 changed files with 12 additions and 0 deletions

@ -457,6 +457,11 @@ struct buildingplan_query_hook : public df::viewscreen_dwarfmodest
}
}
static void invalidateStatics()
{
bld = NULL;
}
bool handleInput(set<df::interface_key> *input)
{
if (!isInPlannedBuildingQueryMode() || Gui::inRenameBuilding())
@ -583,6 +588,11 @@ struct buildingplan_place_hook : public df::viewscreen_dwarfmodest
}
}
static void invalidateStatics()
{
key = BuildingTypeKey();
}
bool handleInput(set<df::interface_key> *input)
{
if (!isInPlannedBuildingPlacementMode())
@ -959,6 +969,8 @@ DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_chan
{
switch (event) {
case SC_MAP_LOADED:
buildingplan_place_hook::invalidateStatics();
buildingplan_query_hook::invalidateStatics();
planner.reset();
roomMonitor.reset(out);
break;