summaryrefslogtreecommitdiff
path: root/ai/default
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-03-15 16:44:50 +0000
committertron <tron@openttd.org>2006-03-15 16:44:50 +0000
commit3d9c76d8b81794ad2e13242eafca1022b6dfbca6 (patch)
tree64e50bf99a33465decab370d13970df72c292068 /ai/default
parent962852b732e02e77438a4a9f8225f87f5009aa55 (diff)
downloadopenttd-3d9c76d8b81794ad2e13242eafca1022b6dfbca6.tar.xz
(svn r3887) Add a function to get the other bridge end when you're at a bridge ramp
Diffstat (limited to 'ai/default')
-rw-r--r--ai/default/default.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/ai/default/default.c b/ai/default/default.c
index 9cfa14f10..c5d463e45 100644
--- a/ai/default/default.c
+++ b/ai/default/default.c
@@ -2146,7 +2146,6 @@ static bool AiRemoveTileAndGoForward(Player *p)
int bit;
const byte *ptr;
TileIndex tile = p->ai.cur_tile_a;
- int offs;
TileIndex tilenew;
if (IsTileType(tile, MP_TUNNELBRIDGE)) {
@@ -2164,13 +2163,9 @@ static bool AiRemoveTileAndGoForward(Player *p)
// This is not really needed the first place AiRemoveTileAndGoForward is called.
if (DiagDirToAxis(GetBridgeRampDirection(tile)) != (p->ai.cur_dir_a & 1U)) return false;
- // Find other side of bridge.
- offs = TileOffsByDir(p->ai.cur_dir_a);
- do {
- tile = TILE_MASK(tile - offs);
- } while (_m[tile].m5 & 0x40);
+ tile = GetOtherBridgeEnd(tile);
- tilenew = TILE_MASK(tile - offs);
+ tilenew = TILE_MASK(tile - TileOffsByDir(p->ai.cur_dir_a));
// And clear the bridge.
if (CmdFailed(DoCommandByTile(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR)))
return false;