diff options
author | tron <tron@openttd.org> | 2006-03-30 09:29:01 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2006-03-30 09:29:01 +0000 |
commit | 7ad0d787e25306e700045cb678c66eeba9ea4434 (patch) | |
tree | 21b00e82b5c9850aa9567dba92d59ebb57aa50ba /station_map.h | |
parent | 84de6477b2665dd0b16f93b677501dde02fc40d5 (diff) | |
download | openttd-7ad0d787e25306e700045cb678c66eeba9ea4434.tar.xz |
(svn r4166) Sprinkle several map accessors with assert()s
Diffstat (limited to 'station_map.h')
-rw-r--r-- | station_map.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/station_map.h b/station_map.h index 77d1f435f..0fb8c50b0 100644 --- a/station_map.h +++ b/station_map.h @@ -9,6 +9,7 @@ static inline StationID GetStationIndex(TileIndex t) { + assert(IsTileType(t, MP_STATION)); return (StationID)_m[t].m2; } @@ -68,11 +69,13 @@ static inline RoadStopType GetRoadStopType(TileIndex t) static inline bool IsRailwayStation(TileIndex t) { + assert(IsTileType(t, MP_STATION)); return _m[t].m5 < RAILWAY_BASE + RAILWAY_SIZE; } static inline bool IsHangar(TileIndex t) { + assert(IsTileType(t, MP_STATION)); return _m[t].m5 == HANGAR_TILE_0 || _m[t].m5 == HANGAR_TILE_1 || @@ -81,6 +84,7 @@ static inline bool IsHangar(TileIndex t) static inline bool IsAirport(TileIndex t) { + assert(IsTileType(t, MP_STATION)); return IS_INT_INSIDE(_m[t].m5, AIRPORT_BASE, AIRPORT_BASE + AIRPORT_SIZE) || IS_INT_INSIDE(_m[t].m5, AIRPORT_BASE_EXTENDED, AIRPORT_BASE_EXTENDED + AIRPORT_SIZE_EXTENDED); @@ -88,11 +92,13 @@ static inline bool IsAirport(TileIndex t) static inline bool IsTruckStop(TileIndex t) { + assert(IsTileType(t, MP_STATION)); return IS_INT_INSIDE(_m[t].m5, TRUCK_BASE, TRUCK_BASE + TRUCK_SIZE); } static inline bool IsBusStop(TileIndex t) { + assert(IsTileType(t, MP_STATION)); return IS_INT_INSIDE(_m[t].m5, BUS_BASE, BUS_BASE + BUS_SIZE); } @@ -103,16 +109,19 @@ static inline bool IsRoadStop(TileIndex t) static inline bool IsOilRig(TileIndex t) { + assert(IsTileType(t, MP_STATION)); return _m[t].m5 == OILRIG_BASE; } static inline bool IsDock(TileIndex t) { + assert(IsTileType(t, MP_STATION)); return IS_INT_INSIDE(_m[t].m5, DOCK_BASE, DOCK_BASE + DOCK_SIZE_TOTAL); } static inline bool IsBuoy_(TileIndex t) // XXX _ due to naming conflict { + assert(IsTileType(t, MP_STATION)); return _m[t].m5 == BUOY_BASE; } @@ -147,17 +156,20 @@ static inline DiagDirection GetDockDirection(TileIndex t) static inline bool IsCustomStationSprite(TileIndex t) { + assert(IsTileType(t, MP_STATION)); return HASBIT(_m[t].m3, 4); } static inline void SetCustomStationSprite(TileIndex t, byte sprite) { + assert(IsTileType(t, MP_STATION)); SETBIT(_m[t].m3, 4); _m[t].m4 = sprite; } static inline uint GetCustomStationSprite(TileIndex t) { + assert(IsTileType(t, MP_STATION)); return _m[t].m4; } |