station.h
changeset 3347 d5d8ace1bb13
parent 3333 41f8abe65d1e
child 3360 edef9ad64773
equal deleted inserted replaced
3346:96c5db77aa83 3347:d5d8ace1bb13
    12 
    12 
    13 typedef struct GoodsEntry {
    13 typedef struct GoodsEntry {
    14 	uint16 waiting_acceptance;
    14 	uint16 waiting_acceptance;
    15 	byte days_since_pickup;
    15 	byte days_since_pickup;
    16 	byte rating;
    16 	byte rating;
    17 	uint16 enroute_from;
    17 	StationID enroute_from;
    18 	byte enroute_time;
    18 	byte enroute_time;
    19 	byte last_speed;
    19 	byte last_speed;
    20 	byte last_age;
    20 	byte last_age;
    21 	int32 feeder_profit;
    21 	int32 feeder_profit;
    22 } GoodsEntry;
    22 } GoodsEntry;
    29 enum {
    29 enum {
    30 	INVALID_STATION = 0xFFFF,
    30 	INVALID_STATION = 0xFFFF,
    31 	NUM_SLOTS = 2,
    31 	NUM_SLOTS = 2,
    32 	ROAD_STOP_LIMIT = 16,
    32 	ROAD_STOP_LIMIT = 16,
    33 };
    33 };
    34 
       
    35 typedef uint16 StationID;
       
    36 
    34 
    37 typedef struct RoadStop {
    35 typedef struct RoadStop {
    38 	TileIndex xy;
    36 	TileIndex xy;
    39 	bool used;
    37 	bool used;
    40 	byte status;
    38 	byte status;
   148 static inline uint16 GetStationPoolSize(void)
   146 static inline uint16 GetStationPoolSize(void)
   149 {
   147 {
   150 	return _station_pool.total_items;
   148 	return _station_pool.total_items;
   151 }
   149 }
   152 
   150 
   153 static inline bool IsStationIndex(uint index)
   151 static inline bool IsStationIndex(StationID index)
   154 {
   152 {
   155 	return index < GetStationPoolSize();
   153 	return index < GetStationPoolSize();
   156 }
   154 }
   157 
   155 
   158 #define FOR_ALL_STATIONS_FROM(st, start) for (st = GetStation(start); st != NULL; st = (st->index + 1 < GetStationPoolSize()) ? GetStation(st->index + 1) : NULL)
   156 #define FOR_ALL_STATIONS_FROM(st, start) for (st = GetStation(start); st != NULL; st = (st->index + 1 < GetStationPoolSize()) ? GetStation(st->index + 1) : NULL)