diff options
author | tron <tron@openttd.org> | 2006-03-17 10:10:31 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2006-03-17 10:10:31 +0000 |
commit | 89090790c2405a738f5977310549cf94df9c06cb (patch) | |
tree | 0fa3ce74d133cc13b1aaf01d162e59d16ce3371e /rail.c | |
parent | d8677f1afad4e706b92689b471d6c7a6c210aa82 (diff) | |
download | openttd-89090790c2405a738f5977310549cf94df9c06cb.tar.xz |
(svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
Diffstat (limited to 'rail.c')
-rw-r--r-- | rail.c | 26 |
1 files changed, 11 insertions, 15 deletions
@@ -108,43 +108,39 @@ const Trackdir _reverse_trackdir[] = { RailType GetTileRailType(TileIndex tile, Trackdir trackdir) { - RailType type = INVALID_RAILTYPE; DiagDirection exitdir = TrackdirToExitdir(trackdir); switch (GetTileType(tile)) { case MP_RAILWAY: - /* railway track */ - type = _m[tile].m3 & RAILTYPE_MASK; - break; + return GetRailType(tile); + case MP_STREET: /* rail/road crossing */ - if (IsLevelCrossing(tile)) - type = _m[tile].m4 & RAILTYPE_MASK; + if (IsLevelCrossing(tile)) return GetRailTypeCrossing(tile); break; + case MP_STATION: - if (IsTrainStationTile(tile)) - type = _m[tile].m3 & RAILTYPE_MASK; + if (IsTrainStationTile(tile)) return GetRailType(tile); break; + case MP_TUNNELBRIDGE: if (IsTunnel(tile)) { if (GetTunnelTransportType(tile) == TRANSPORT_RAIL) { - return _m[tile].m3 & RAILTYPE_MASK; + return GetRailType(tile); } } else { if (IsBridgeRamp(tile)) { if (GetBridgeTransportType(tile) == TRANSPORT_RAIL) { - return _m[tile].m3 & RAILTYPE_MASK; + return GetRailType(tile); } } else { if (GetBridgeAxis(tile) == DiagDirToAxis(exitdir)) { if (GetBridgeTransportType(tile) == TRANSPORT_RAIL) { - /* on the bridge */ - return (_m[tile].m3 >> 4) & RAILTYPE_MASK; + return GetRailTypeOnBridge(tile); } } else { if (IsTransportUnderBridge(tile) && GetTransportTypeUnderBridge(tile) == TRANSPORT_RAIL) { - /* under the bridge */ - return _m[tile].m3 & RAILTYPE_MASK; + return GetRailType(tile); } } } @@ -154,5 +150,5 @@ RailType GetTileRailType(TileIndex tile, Trackdir trackdir) default: break; } - return type; + return INVALID_RAILTYPE; } |