|
@@ -137,24 +137,29 @@ static inline Station *GetStation(Statio
|
|
|
{
|
|
|
return (Station*)GetItemFromPool(&_station_pool, index);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Get the current size of the StationPool
|
|
|
*/
|
|
|
static inline uint16 GetStationPoolSize(void)
|
|
|
{
|
|
|
return _station_pool.total_items;
|
|
|
}
|
|
|
|
|
|
static inline bool IsStationIndex(uint index)
|
|
|
{
|
|
|
return index < GetStationPoolSize();
|
|
|
}
|
|
|
|
|
|
#define FOR_ALL_STATIONS_FROM(st, start) for (st = GetStation(start); st != NULL; st = (st->index + 1 < GetStationPoolSize()) ? GetStation(st->index + 1) : NULL)
|
|
|
#define FOR_ALL_STATIONS(st) FOR_ALL_STATIONS_FROM(st, 0)
|
|
|
|
|
|
|
|
|
/* Stuff for ROADSTOPS */
|
|
|
|
|
|
extern MemoryPool _roadstop_pool;
|
|
|
|
|
|
/**
|
|
|
* Get the pointer to the roadstop with index 'index'
|
|
|
*/
|
|
|
static inline RoadStop *GetRoadStop(uint index)
|
|
@@ -283,25 +288,25 @@ static inline bool IsCompatibleTrainStat
|
|
|
IsTrainStationTile(tile) &&
|
|
|
(_map3_lo[tile] & 0x0F) == (_map3_lo[ref] & 0x0F) && // same rail type?
|
|
|
(_map5[tile] & 0x01) == (_map5[ref] & 0x01); // same direction?
|
|
|
}
|
|
|
|
|
|
static inline bool IsRoadStationTile(uint tile) {
|
|
|
return IsTileType(tile, MP_STATION) && IS_BYTE_INSIDE(_map5[tile], 0x43, 0x4B);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Check if a station really exists.
|
|
|
*/
|
|
|
static inline bool IsValidStation(Station* station)
|
|
|
static inline bool IsValidStation(const Station* station)
|
|
|
{
|
|
|
return station->xy != 0; /* XXX: Replace by INVALID_TILE someday */
|
|
|
}
|
|
|
|
|
|
/* Get's the direction the station exit points towards. Ie, returns 0 for a
|
|
|
* station with the exit NE. */
|
|
|
static inline byte GetRoadStationDir(uint tile) {
|
|
|
assert(IsRoadStationTile(tile));
|
|
|
return (_map5[tile] - 0x43) & 3;
|
|
|
}
|
|
|
|
|
|
#endif /* STATION_H */
|