summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2007-11-09 13:21:48 +0000
committertruelight <truelight@openttd.org>2007-11-09 13:21:48 +0000
commite4aec527e0cdda2cda4fbc77a154eb13964f8451 (patch)
treed1a8230969497850e4f104c53012de6df4186122 /src
parent2493626f2106f4d566b4dbc82480a731ec37a755 (diff)
downloadopenttd-e4aec527e0cdda2cda4fbc77a154eb13964f8451.tar.xz
(svn r11397) -Fix r11395: some minor fixes for better town-bridge results (and better comments) (skidd13 / TrueLight)
Diffstat (limited to 'src')
-rw-r--r--src/town_cmd.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index e04fccadb..8a9e00dd5 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -907,7 +907,8 @@ static bool GrowTownWithBridge(const Town *t, TileIndex tile, DiagDirection brid
/* Make sure the direction is compatible with the slope.
* If any of the following bits match, the slope is forbidden for
- * that diagdir. Total of 5 slopes per direction.
+ * that diagdir. This means 5 non-steep slopes, and 3 steep-slopes
+ * per diagdir.
* 0 -> 0b1100
* 1 -> 0b0110
* 2 -> 0b0011
@@ -916,8 +917,11 @@ static bool GrowTownWithBridge(const Town *t, TileIndex tile, DiagDirection brid
* the direction to get the forbidden slope mask. */
if (HASBITS(slope & 0x0F, 0xCC >> bridge_dir)) return false;
+ /* Assure that the bridge is connectable to the start side */
+ if (!(GetTownRoadBits(TileAddByDiagDir(tile, ReverseDiagDir(bridge_dir))) & DiagDirToRoadBits(bridge_dir))) return false;
+
/* We are in the right direction */
- uint32 bridge_length = 0; // This value stores the length of the possible bridge
+ uint8 bridge_length = 0; // This value stores the length of the possible bridge
TileIndex bridge_tile = tile; // Used to store the other waterside
do {
@@ -925,7 +929,7 @@ static bool GrowTownWithBridge(const Town *t, TileIndex tile, DiagDirection brid
/* Max 11 tile long bridges */
return false;
}
- bridge_tile = TILE_MASK(bridge_tile + TileOffsByDiagDir(bridge_dir));
+ bridge_tile = TileAddByDiagDir(bridge_tile, bridge_dir);
} while (IsWaterTile(bridge_tile));
/* no water tiles in between? */