equal
deleted
inserted
replaced
142 * Get the current size of the StationPool |
142 * Get the current size of the StationPool |
143 */ |
143 */ |
144 static inline uint16 GetStationPoolSize(void) |
144 static inline uint16 GetStationPoolSize(void) |
145 { |
145 { |
146 return _station_pool.total_items; |
146 return _station_pool.total_items; |
|
147 } |
|
148 |
|
149 static inline bool IsStationIndex(uint index) |
|
150 { |
|
151 return index < GetStationPoolSize(); |
147 } |
152 } |
148 |
153 |
149 #define FOR_ALL_STATIONS_FROM(st, start) for (st = GetStation(start); st != NULL; st = (st->index + 1 < GetStationPoolSize()) ? GetStation(st->index + 1) : NULL) |
154 #define FOR_ALL_STATIONS_FROM(st, start) for (st = GetStation(start); st != NULL; st = (st->index + 1 < GetStationPoolSize()) ? GetStation(st->index + 1) : NULL) |
150 #define FOR_ALL_STATIONS(st) FOR_ALL_STATIONS_FROM(st, 0) |
155 #define FOR_ALL_STATIONS(st) FOR_ALL_STATIONS_FROM(st, 0) |
151 |
156 |
290 } |
295 } |
291 |
296 |
292 /** |
297 /** |
293 * Check if a station really exists. |
298 * Check if a station really exists. |
294 */ |
299 */ |
295 static inline bool IsValidStation(Station* station) |
300 static inline bool IsValidStation(const Station* station) |
296 { |
301 { |
297 return station->xy != 0; /* XXX: Replace by INVALID_TILE someday */ |
302 return station->xy != 0; /* XXX: Replace by INVALID_TILE someday */ |
298 } |
303 } |
299 |
304 |
300 /* Get's the direction the station exit points towards. Ie, returns 0 for a |
305 /* Get's the direction the station exit points towards. Ie, returns 0 for a |