summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-03-01 13:35:40 +0000
committerrubidium <rubidium@openttd.org>2007-03-01 13:35:40 +0000
commitdd403b586d779c9bf45b658323733c51508c235e (patch)
tree0880b99a709837e01bdb6038d8179f7ed60b4986 /src
parent0945c6950b34ff0e9975b77c9aa4d6f51a5f429b (diff)
downloadopenttd-dd403b586d779c9bf45b658323733c51508c235e.tar.xz
(svn r8954) -Codechange: remove direct map accesses from non-map-accessor headers.
Diffstat (limited to 'src')
-rw-r--r--src/depot.h11
-rw-r--r--src/rail_map.h4
-rw-r--r--src/waypoint.h2
3 files changed, 12 insertions, 5 deletions
diff --git a/src/depot.h b/src/depot.h
index 61272670b..1a60bf940 100644
--- 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 @@ static inline bool IsTileDepotType(TileIndex tile, TransportType type)
{
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;
}
}
diff --git a/src/rail_map.h b/src/rail_map.h
index 20df4e7be..540643253 100644
--- a/src/rail_map.h
+++ b/src/rail_map.h
@@ -113,6 +113,10 @@ static inline TrackBits GetRailWaypointBits(TileIndex t)
return TrackToTrackBits(GetRailWaypointTrack(t));
}
+static inline WaypointID GetWaypointIndex(TileIndex t)
+{
+ return (WaypointID)_m[t].m2;
+}
typedef enum SignalType {
SIGTYPE_NORMAL = 0, // normal signal
diff --git a/src/waypoint.h b/src/waypoint.h
index 75366fb18..7292a15f3 100644
--- a/src/waypoint.h
+++ b/src/waypoint.h
@@ -59,7 +59,7 @@ static inline void DeleteWaypoint(Waypoint *wp)
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);