summaryrefslogtreecommitdiff
path: root/town_cmd.c
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2004-09-15 18:36:33 +0000
committertruelight <truelight@openttd.org>2004-09-15 18:36:33 +0000
commita69e422cdda77f59e77c8db7bd1b8af0bf8dafdb (patch)
treee7f4d150b64cd500924d16fb14705ca8702375d3 /town_cmd.c
parent0346fec1cad4fa96368e3102c2b42d0a85e288e1 (diff)
downloadopenttd-a69e422cdda77f59e77c8db7bd1b8af0bf8dafdb.tar.xz
(svn r266) -Fix: hopefully fixed the desync problem nicely (and reverted the
workaround for it)
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;
}