summaryrefslogtreecommitdiff
path: root/town_cmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'town_cmd.c')
-rw-r--r--town_cmd.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/town_cmd.c b/town_cmd.c
index ee5de74f3..54237df99 100644
--- a/town_cmd.c
+++ b/town_cmd.c
@@ -694,6 +694,7 @@ bool GrowTown(Town *t)
const TileIndexDiff *ptr;
int offs;
TileInfo ti;
+ byte old_player;
static const TileIndexDiff _town_coord_mod[] = {
TILE_XY(-1,0),
@@ -712,6 +713,7 @@ bool GrowTown(Town *t)
};
// Current player is a town
+ old_player = _current_player;
_current_player = OWNER_TOWN;
// Find a road that we can base the construction on.
@@ -719,7 +721,9 @@ bool GrowTown(Town *t)
ptr = _town_coord_mod;
do {
if (GetRoadBitsByTile(tile) != 0) {
- return GrowTownAtRoad(t, tile);
+ int r = GrowTownAtRoad(t, tile);
+ _current_player = old_player;
+ return r;
}
offs = *ptr++;
@@ -737,6 +741,7 @@ bool GrowTown(Town *t)
if (ti.tileh == 0 && !(ti.type==MP_HOUSE && ti.map5==0)) {
if (DoCommandByTile(tile, 0, 0, DC_AUTO, CMD_LANDSCAPE_CLEAR) != CMD_ERROR) {
DoCommandByTile(tile, GenRandomRoadBits(), 0, DC_EXEC | DC_AUTO, CMD_BUILD_ROAD);
+ _current_player = old_player;
return true;
}
}
@@ -744,6 +749,7 @@ bool GrowTown(Town *t)
tile = TILE_ADD(tile, offs);
} while (offs != 0);
+ _current_player = old_player;
return false;
}