1
0
Fork 0

Codefix: CmdFoundTown should always return TownID if successful

pull/10409/head
Tyler Trahan 2024-05-28 17:35:47 -04:00
parent 42652b6698
commit e08bc4d6e3
1 changed files with 3 additions and 5 deletions

View File

@ -2158,15 +2158,13 @@ std::tuple<CommandCost, Money, TownID> CmdFoundTown(DoCommandFlag flags, TileInd
Town *t; Town *t;
if (random_location) { if (random_location) {
t = CreateRandomTown(20, townnameparts, size, city, layout); t = CreateRandomTown(20, townnameparts, size, city, layout);
if (t == nullptr) { if (t == nullptr) return { CommandCost(STR_ERROR_NO_SPACE_FOR_TOWN), 0, INVALID_TOWN };
cost = CommandCost(STR_ERROR_NO_SPACE_FOR_TOWN);
} else {
new_town = t->index;
}
} else { } else {
t = new Town(tile); t = new Town(tile);
DoCreateTown(t, tile, townnameparts, size, city, layout, true); DoCreateTown(t, tile, townnameparts, size, city, layout, true);
} }
new_town = t->index;
UpdateNearestTownForRoadTiles(false); UpdateNearestTownForRoadTiles(false);
old_generating_world.Restore(); old_generating_world.Restore();