summaryrefslogtreecommitdiff
path: root/src/rail_map.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/rail_map.h')
-rw-r--r--src/rail_map.h28
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 */