summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-08-22 11:47:15 +0000
committerrubidium <rubidium@openttd.org>2011-08-22 11:47:15 +0000
commit4c030468e13bfb113a8672a80a27efc7e1fa325f (patch)
treea44fc20d134dccef1aab40305490379bfaf58902
parent9023de2c1fcd7a74b79f00f99ff009414c2376ef (diff)
downloadopenttd-4c030468e13bfb113a8672a80a27efc7e1fa325f.tar.xz
(svn r22809) -Fix [FS#4731]: towns expanding from the "wrong" side of a tunnel or bridge
-rw-r--r--src/town_cmd.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index 015406347..e98079db5 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -1236,9 +1236,14 @@ static int GrowTownAtRoad(Town *t, TileIndex tile)
return _grow_town_result;
}
- /* Select a random bit from the blockmask, walk a step
- * and continue the search from there. */
- do target_dir = RandomDiagDir(); while (!(cur_rb & DiagDirToRoadBits(target_dir)));
+ if (IsTileType(tile, MP_TUNNELBRIDGE)) {
+ /* Only build in the direction away from the tunnel or bridge. */
+ target_dir = ReverseDiagDir(GetTunnelBridgeDirection(tile));
+ } else {
+ /* Select a random bit from the blockmask, walk a step
+ * and continue the search from there. */
+ do target_dir = RandomDiagDir(); while (!(cur_rb & DiagDirToRoadBits(target_dir)));
+ }
tile = TileAddByDiagDir(tile, target_dir);
if (IsTileType(tile, MP_ROAD) && !IsRoadDepot(tile) && HasTileRoadType(tile, ROADTYPE_ROAD)) {