equal
deleted
inserted
replaced
1 /* $Id$ */ |
1 /* $Id$ */ |
2 |
2 |
3 #include "../../stdafx.h" |
3 #include "../../stdafx.h" |
4 #include "../../openttd.h" |
4 #include "../../openttd.h" |
|
5 #include "../../bridge_map.h" |
5 #include "../../functions.h" |
6 #include "../../functions.h" |
6 #include "../../map.h" |
7 #include "../../map.h" |
7 #include "../../rail_map.h" |
8 #include "../../rail_map.h" |
8 #include "../../road_map.h" |
9 #include "../../road_map.h" |
9 #include "../../tile.h" |
10 #include "../../tile.h" |
2159 |
2160 |
2160 if (!(_m[tile].m5 & 0x40)) { |
2161 if (!(_m[tile].m5 & 0x40)) { |
2161 |
2162 |
2162 // Check if the bridge points in the right direction. |
2163 // Check if the bridge points in the right direction. |
2163 // This is not really needed the first place AiRemoveTileAndGoForward is called. |
2164 // This is not really needed the first place AiRemoveTileAndGoForward is called. |
2164 if ((_m[tile].m5 & 1) != (p->ai.cur_dir_a & 1)) return false; |
2165 if (DiagDirToAxis(GetBridgeRampDirection(tile)) != (p->ai.cur_dir_a & 1U)) return false; |
2165 |
2166 |
2166 // Find other side of bridge. |
2167 // Find other side of bridge. |
2167 offs = TileOffsByDir(p->ai.cur_dir_a); |
2168 offs = TileOffsByDir(p->ai.cur_dir_a); |
2168 do { |
2169 do { |
2169 tile = TILE_MASK(tile - offs); |
2170 tile = TILE_MASK(tile - offs); |
3671 0, |
3672 0, |
3672 DC_EXEC, |
3673 DC_EXEC, |
3673 CMD_REMOVE_ROAD); |
3674 CMD_REMOVE_ROAD); |
3674 } |
3675 } |
3675 } else if (IsTileType(tile, MP_TUNNELBRIDGE)) { |
3676 } else if (IsTileType(tile, MP_TUNNELBRIDGE)) { |
3676 byte b; |
|
3677 |
|
3678 if (!IsTileOwner(tile, _current_player) || (_m[tile].m5 & 0xC6) != 0x80) |
3677 if (!IsTileOwner(tile, _current_player) || (_m[tile].m5 & 0xC6) != 0x80) |
3679 return; |
3678 return; |
3680 |
3679 |
3681 m5 = 0; |
3680 m5 = 0; |
3682 |
3681 |
3683 b = _m[tile].m5 & 0x21; |
3682 switch (GetBridgeRampDirection(tile)) { |
3684 if (b == 0) goto pos_0; |
3683 default: |
3685 if (b == 1) goto pos_3; |
3684 case DIAGDIR_NE: goto pos_2; |
3686 if (b == 0x20) goto pos_2; |
3685 case DIAGDIR_SE: goto pos_3; |
3687 goto pos_1; |
3686 case DIAGDIR_SW: goto pos_0; |
|
3687 case DIAGDIR_NW: goto pos_1; |
|
3688 } |
3688 } |
3689 } |
3689 } |
3690 } |
3690 |
3691 |
3691 static void AiStateRemoveTrack(Player *p) |
3692 static void AiStateRemoveTrack(Player *p) |
3692 { |
3693 { |