(svn r25789) -Fix (r25783): Calling GSTown.FoundTown in world gen caused world gen to terminate and start the game

This commit is contained in:
zuu 2013-09-21 15:09:00 +00:00
parent ab69c6c2a0
commit ffec9b41e8

View File

@ -1667,7 +1667,7 @@ CommandCost CmdFoundTown(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
return CommandCost(EXPENSES_OTHER); return CommandCost(EXPENSES_OTHER);
} }
_generating_world = true; Backup<bool> old_generating_world(_generating_world, true, FILE_LINE);
UpdateNearestTownForRoadTiles(true); UpdateNearestTownForRoadTiles(true);
Town *t; Town *t;
if (random) { if (random) {
@ -1682,7 +1682,7 @@ CommandCost CmdFoundTown(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
DoCreateTown(t, tile, townnameparts, size, city, layout, true); DoCreateTown(t, tile, townnameparts, size, city, layout, true);
} }
UpdateNearestTownForRoadTiles(false); UpdateNearestTownForRoadTiles(false);
_generating_world = false; old_generating_world.Restore();
if (t != NULL && !StrEmpty(text)) { if (t != NULL && !StrEmpty(text)) {
t->name = strdup(text); t->name = strdup(text);