diff options
author | celestar <celestar@openttd.org> | 2007-02-13 15:42:52 +0000 |
---|---|---|
committer | celestar <celestar@openttd.org> | 2007-02-13 15:42:52 +0000 |
commit | a89f2fd610733d863e77ef5436c20ac592666032 (patch) | |
tree | 97f07e8c9bbb7b74d420386b638d4c6d8944d7a7 /src/station.h | |
parent | 82c696688c9f66c701a2426acc4aed4fd67f2730 (diff) | |
download | openttd-a89f2fd610733d863e77ef5436c20ac592666032.tar.xz |
(svn r8707) -Codechange: Turn IsValidStation into a method of Station
Diffstat (limited to 'src/station.h')
-rw-r--r-- | src/station.h | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/station.h b/src/station.h index 40d5297ef..38fcf058f 100644 --- a/src/station.h +++ b/src/station.h @@ -168,6 +168,7 @@ struct Station { void MarkTilesDirty() const; bool TileBelongsToRailStation(TileIndex tile) const; bool IsBuoy() const; + bool IsValid() const; protected: static Station *AllocateRaw(void); @@ -237,20 +238,12 @@ static inline uint GetNumStations(void) return GetStationPoolSize(); } -/** - * Check if a station really exists. - */ -static inline bool IsValidStation(const Station *st) -{ - return st->xy != 0; -} - static inline bool IsValidStationID(StationID index) { - return index < GetStationPoolSize() && IsValidStation(GetStation(index)); + return index < GetStationPoolSize() && GetStation(index)->IsValid(); } -#define FOR_ALL_STATIONS_FROM(st, start) for (st = GetStation(start); st != NULL; st = (st->index + 1U < GetStationPoolSize()) ? GetStation(st->index + 1U) : NULL) if (IsValidStation(st)) +#define FOR_ALL_STATIONS_FROM(st, start) for (st = GetStation(start); st != NULL; st = (st->index + 1U < GetStationPoolSize()) ? GetStation(st->index + 1U) : NULL) if (st->IsValid()) #define FOR_ALL_STATIONS(st) FOR_ALL_STATIONS_FROM(st, 0) |