summaryrefslogtreecommitdiff
path: root/npf.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-06-07 19:35:21 +0000
committertron <tron@openttd.org>2006-06-07 19:35:21 +0000
commitbe88e269b918b365695e84cfa962e8d21b98e759 (patch)
tree5a6fb4aa93546ad194301d231de10ba5370ccc6f /npf.c
parentace071529e2116f92aeec50d3bac0f95953b129b (diff)
downloadopenttd-be88e269b918b365695e84cfa962e8d21b98e759.tar.xz
(svn r5155) - Remove the bridge branch merge (revision r5070)
Diffstat (limited to 'npf.c')
-rw-r--r--npf.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/npf.c b/npf.c
index 9e41f76f7..f3cf1f1fc 100644
--- a/npf.c
+++ b/npf.c
@@ -480,7 +480,17 @@ static bool VehicleMayEnterTile(Owner owner, TileIndex tile, DiagDirection enter
case MP_TUNNELBRIDGE:
if ((IsTunnel(tile) && GetTunnelTransportType(tile) == TRANSPORT_RAIL) ||
- (IsBridge(tile) && GetBridgeTransportType(tile) == TRANSPORT_RAIL)) {
+ (IsBridge(tile) && (
+ (
+ IsBridgeRamp(tile) &&
+ GetBridgeTransportType(tile) == TRANSPORT_RAIL
+ ) || (
+ IsBridgeMiddle(tile) &&
+ IsTransportUnderBridge(tile) &&
+ GetTransportTypeUnderBridge(tile) == TRANSPORT_RAIL &&
+ GetBridgeAxis(tile) != DiagDirToAxis(enterdir)
+ )
+ ))) {
return IsTileOwner(tile, owner);
}
break;
@@ -524,7 +534,6 @@ static void NPFFollowTrack(AyStar* aystar, OpenListNode* current)
int i;
TrackdirBits trackdirbits, ts;
TransportType type = aystar->user_data[NPF_TYPE];
- bool override_dst_check = false;
/* Initialize to 0, so we can jump out (return) somewhere an have no neighbours */
aystar->num_neighbours = 0;
DEBUG(npf, 4)("Expanding: (%d, %d, %d) [%d]", TileX(src_tile), TileY(src_tile), src_trackdir, src_tile);
@@ -535,10 +544,6 @@ static void NPFFollowTrack(AyStar* aystar, OpenListNode* current)
* otherwise we wouldn't have got here. It is also facing us,
* so we should skip it's body */
dst_tile = GetOtherTunnelEnd(src_tile);
- override_dst_check = true;
- } else if (IsBridgeTile(src_tile) && GetBridgeRampDirection(src_tile) == src_exitdir) {
- dst_tile = GetOtherBridgeEnd(src_tile);
- override_dst_check = true;
} else if (type != TRANSPORT_WATER && (IsRoadStopTile(src_tile) || IsTileDepotType(src_tile, type))) {
/* This is a road station or a train or road depot. We can enter and exit
* those from one side only. Trackdirs don't support that (yet), so we'll
@@ -586,14 +591,8 @@ static void NPFFollowTrack(AyStar* aystar, OpenListNode* current)
/* I can't enter a tunnel entry/exit tile from a tile above the tunnel. Note
* that I can enter the tunnel from a tile below the tunnel entrance. This
* solves the problem of vehicles wanting to drive off a tunnel entrance */
- if (!override_dst_check) {
- if (IsTileType(dst_tile, MP_TUNNELBRIDGE)) {
- if (IsTunnel(dst_tile)) {
- if (GetTunnelDirection(dst_tile) != src_exitdir) return;
- } else {
- if (GetBridgeRampDirection(dst_tile) != src_exitdir) return;
- }
- }
+ if (IsTunnelTile(dst_tile) && GetTileZ(dst_tile) < GetTileZ(src_tile)) {
+ return;
}
/* check correct rail type (mono, maglev, etc) */