summaryrefslogtreecommitdiff
path: root/npf.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-03-16 15:16:27 +0000
committertron <tron@openttd.org>2006-03-16 15:16:27 +0000
commitb8da06ddb11f234451864e0b454163ebb546e4cd (patch)
tree79a0e9518fd43cbe914bddcaebf4983201598bc8 /npf.c
parentd6134455a5aaa7b247545886be573a555cdfc2be (diff)
downloadopenttd-b8da06ddb11f234451864e0b454163ebb546e4cd.tar.xz
(svn r3907) Replace many bridge related direct map accesses with calls to shiny new functions and mark some strange constructs with XXX
Diffstat (limited to 'npf.c')
-rw-r--r--npf.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/npf.c b/npf.c
index b9b49cb37..6965e9e5c 100644
--- a/npf.c
+++ b/npf.c
@@ -2,6 +2,7 @@
#include "stdafx.h"
#include "openttd.h"
+#include "bridge_map.h"
#include "debug.h"
#include "functions.h"
#include "npf.h"
@@ -484,8 +485,10 @@ static bool VehicleMayEnterTile(Owner owner, TileIndex tile, DiagDirection enter
/* if we were on a railway middle part, we are now at a railway bridge ending */
#endif
if ((IsTunnel(tile) && GetTunnelTransportType(tile) == TRANSPORT_RAIL) ||
- (_m[tile].m5 & 0xC6) == 0x80 || /* railway bridge ending */
- ((_m[tile].m5 & 0xF8) == 0xE0 && GB(_m[tile].m5, 0, 1) != (enterdir & 0x1))) { /* railway under bridge */
+ (IsBridge(tile) && (
+ (IsBridgeRamp(tile) && GetBridgeTransportType(tile) == TRANSPORT_RAIL) ||
+ (IsBridgeMiddle(tile) && IsTransportUnderBridge(tile) && GetTransportTypeUnderBridge(tile) == TRANSPORT_RAIL)
+ ))) {
return IsTileOwner(tile, owner);
}
break;