diff options
author | Erich Eckner <git@eckner.net> | 2018-10-30 11:13:12 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-10-30 15:28:03 +0100 |
commit | a34d095259409cf1454d9777deabbc00bcdb9407 (patch) | |
tree | 9e7c37ed33f5bd6b3c2f41cf248dcb656b2a4afa /src/rail_map.h | |
parent | 6647cb917963c4e0d6d633b7a92af78167050893 (diff) | |
download | openttd-a34d095259409cf1454d9777deabbc00bcdb9407.tar.xz |
underground patch appliedunderground-plus-others-original
Diffstat (limited to 'src/rail_map.h')
-rw-r--r-- | src/rail_map.h | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/src/rail_map.h b/src/rail_map.h index c8033a311..8a385c5b4 100644 --- a/src/rail_map.h +++ b/src/rail_map.h @@ -525,9 +525,7 @@ static inline void MakeRailNormal(TileIndex t, Owner o, TrackBits b, RailType r) _m[t].m3 = r; _m[t].m4 = 0; _m[t].m5 = RAIL_TILE_NORMAL << 6 | b; - SB(_m[t].m6, 2, 4, 0); - _me[t].m7 = 0; -} + SB(_m[t].m6, 2, 4, 0); _me[t].m7 = 0;} static inline void MakeRailDepot(TileIndex t, Owner o, DepotID did, DiagDirection d, RailType r) @@ -542,4 +540,28 @@ static inline void MakeRailDepot(TileIndex t, Owner o, DepotID did, DiagDirectio _me[t].m7 = 0; } + + +static inline void IncreaseStuckCounter(TileIndex t) +{ + if (!IsTileType(t, MP_RAILWAY)) return; + if (_me[t].m7 == 255) return; + _me[t].m7++; +} + + +static inline void ReduceStuckCounter(TileIndex t) +{ + if (!IsTileType(t, MP_RAILWAY)) return; + _me[t].m7 -= _me[t].m7/4; +} + + +static inline byte GetStuckCounter(TileIndex t) +{ + if (!IsTileType(t, MP_RAILWAY)) return 0; + return _me[t].m7; + +} + #endif /* RAIL_MAP_H */ |