summaryrefslogtreecommitdiff
path: root/src/station.h
diff options
context:
space:
mode:
authorcelestar <celestar@openttd.org>2007-01-25 08:58:09 +0000
committercelestar <celestar@openttd.org>2007-01-25 08:58:09 +0000
commite3fbc6c06b0de814584b57cf53517e28de2c33a6 (patch)
treee292edda60dfc48c8bacab52f28e2230d012785c /src/station.h
parent1da6c719fdde95178963b45cc0cc23a9a601fb34 (diff)
downloadopenttd-e3fbc6c06b0de814584b57cf53517e28de2c33a6.tar.xz
(svn r8401) -Codechange: Make 'IsValidRoadStop' a method of RoadStop and rename it to 'IsValid'
-Codechange: While I'm at it, put 'RoadStop::AllocateRaw' into the protected section
Diffstat (limited to 'src/station.h')
-rw-r--r--src/station.h12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/station.h b/src/station.h
index b4365d2ba..0202e7209 100644
--- a/src/station.h
+++ b/src/station.h
@@ -64,6 +64,8 @@ typedef struct RoadStop {
void *operator new (size_t size, int index);
void operator delete(void *rs, int index);
+ bool IsValid() const;
+protected:
static RoadStop *AllocateRaw(void);
} RoadStop;
@@ -253,15 +255,7 @@ static inline bool IsValidStationID(StationID index)
DECLARE_OLD_POOL(RoadStop, RoadStop, 5, 2000)
-/**
- * Check if a RaodStop really exists.
- */
-static inline bool IsValidRoadStop(const RoadStop *rs)
-{
- return rs->xy != INVALID_TILE;
-}
-
-#define FOR_ALL_ROADSTOPS_FROM(rs, start) for (rs = GetRoadStop(start); rs != NULL; rs = (rs->index + 1U < GetRoadStopPoolSize()) ? GetRoadStop(rs->index + 1U) : NULL) if (IsValidRoadStop(rs))
+#define FOR_ALL_ROADSTOPS_FROM(rs, start) for (rs = GetRoadStop(start); rs != NULL; rs = (rs->index + 1U < GetRoadStopPoolSize()) ? GetRoadStop(rs->index + 1U) : NULL) if (rs->IsValid())
#define FOR_ALL_ROADSTOPS(rs) FOR_ALL_ROADSTOPS_FROM(rs, 0)
/* End of stuff for ROADSTOPS */