summaryrefslogtreecommitdiff
path: root/road_map.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 /road_map.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 'road_map.c')
-rw-r--r--road_map.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/road_map.c b/road_map.c
index 756ab1a92..aa1c50470 100644
--- a/road_map.c
+++ b/road_map.c
@@ -25,15 +25,16 @@ RoadBits GetAnyRoadBits(TileIndex tile)
return DiagDirToRoadBits(GetRoadStationDir(tile));
case MP_TUNNELBRIDGE:
- if (_m[tile].m5 & 0x80) {
- // bridge
- if (_m[tile].m5 & 0x40) {
- // middle part
- if ((_m[tile].m5 & 0x38) != 0x28) return 0; // no road under bridge
- return _m[tile].m5 & 1 ? ROAD_X : ROAD_Y;
+ if (IsBridge(tile)) {
+ if (IsBridgeMiddle(tile)) {
+ if (!IsTransportUnderBridge(tile) ||
+ GetBridgeTransportType(tile) != TRANSPORT_ROAD) {
+ return 0;
+ }
+ return GetRoadBitsUnderBridge(tile);
} else {
// ending
- if (GB(_m[tile].m5, 1, 2) != TRANSPORT_ROAD) return 0; // not a road bridge
+ if (GetBridgeTransportType(tile) != TRANSPORT_ROAD) return 0;
return DiagDirToRoadBits(ReverseDiagDir(GetBridgeRampDirection(tile)));
}
} else {