Mercurial > hg > openttd
changeset 6182:e1626f2e63ad draft
(svn r8954) -Codechange: remove direct map accesses from non-map-accessor headers.
author | rubidium <rubidium@openttd.org> |
---|---|
date | Thu, 01 Mar 2007 13:35:40 +0000 |
parents | b7468d932e39 |
children | 9da82bce7276 |
files | src/depot.h src/rail_map.h src/waypoint.h |
diffstat | 3 files changed, 12 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/depot.h +++ b/src/depot.h @@ -9,6 +9,9 @@ #include "oldpool.h" #include "tile.h" #include "variables.h" +#include "road_map.h" +#include "rail_map.h" +#include "water_map.h" struct Depot { TileIndex xy; @@ -68,16 +71,16 @@ { switch (type) { case TRANSPORT_RAIL: - return IsTileType(tile, MP_RAILWAY) && (_m[tile].m5 & 0xFC) == 0xC0; + return IsTileType(tile, MP_RAILWAY) && GetRailTileType(tile) == RAIL_TILE_DEPOT; case TRANSPORT_ROAD: - return IsTileType(tile, MP_STREET) && (_m[tile].m5 & 0xF0) == 0x20; + return IsTileType(tile, MP_STREET) && GetRoadTileType(tile) == ROAD_TILE_DEPOT; case TRANSPORT_WATER: - return IsTileType(tile, MP_WATER) && (_m[tile].m5 & ~3) == 0x80; + return IsTileType(tile, MP_WATER) && GetWaterTileType(tile) == WATER_TILE_DEPOT; default: - assert(0); + NOT_REACHED(); return false; } }
--- a/src/rail_map.h +++ b/src/rail_map.h @@ -113,6 +113,10 @@ return TrackToTrackBits(GetRailWaypointTrack(t)); } +static inline WaypointID GetWaypointIndex(TileIndex t) +{ + return (WaypointID)_m[t].m2; +} typedef enum SignalType { SIGTYPE_NORMAL = 0, // normal signal
--- a/src/waypoint.h +++ b/src/waypoint.h @@ -59,7 +59,7 @@ static inline Waypoint *GetWaypointByTile(TileIndex tile) { assert(IsTileType(tile, MP_RAILWAY) && IsRailWaypoint(tile)); - return GetWaypoint(_m[tile].m2); + return GetWaypoint(GetWaypointIndex(tile)); } int32 RemoveTrainWaypoint(TileIndex tile, uint32 flags, bool justremove);