station.h
changeset 1272 d3e09adb7736
parent 1266 9dc5638fe8cc
child 1284 06a52178bf46
equal deleted inserted replaced
1271:2b8bfb61ce90 1272:d3e09adb7736
     1 #ifndef STATION_H
     1 #ifndef STATION_H
     2 #define STATION_H
     2 #define STATION_H
     3 
     3 
       
     4 #include "pool.h"
     4 #include "sprite.h"
     5 #include "sprite.h"
     5 #include "tile.h"
     6 #include "tile.h"
     6 #include "vehicle.h"
     7 #include "vehicle.h"
     7 
     8 
     8 typedef struct GoodsEntry {
     9 typedef struct GoodsEntry {
   123 
   124 
   124 void ShowStationViewWindow(int station);
   125 void ShowStationViewWindow(int station);
   125 void UpdateAllStationVirtCoord(void);
   126 void UpdateAllStationVirtCoord(void);
   126 
   127 
   127 VARDEF RoadStop _roadstops[NUM_ROAD_STOPS * 2];
   128 VARDEF RoadStop _roadstops[NUM_ROAD_STOPS * 2];
   128 VARDEF Station _stations[250];
       
   129 VARDEF uint _roadstops_size;
   129 VARDEF uint _roadstops_size;
   130 VARDEF uint _stations_size;
       
   131 
   130 
   132 VARDEF SortStruct *_station_sort;
   131 VARDEF SortStruct *_station_sort;
   133 
   132 
       
   133 extern MemoryPool _station_pool;
       
   134 
       
   135 /**
       
   136  * Get the pointer to the station with index 'index'
       
   137  */
   134 static inline Station *GetStation(uint index)
   138 static inline Station *GetStation(uint index)
   135 {
   139 {
   136 	assert(index < _stations_size);
   140 	return (Station*)GetItemFromPool(&_station_pool, index);
   137 	return &_stations[index];
   141 }
   138 }
   142 
   139 
   143 /**
   140 #define FOR_ALL_STATIONS(st) for(st = _stations; st != &_stations[_stations_size]; st++)
   144  * Get the current size of the StationPool
       
   145  */
       
   146 static inline uint16 GetStationPoolSize(void)
       
   147 {
       
   148 	return _station_pool.total_items;
       
   149 }
       
   150 
       
   151 #define FOR_ALL_STATIONS_FROM(st, start) for (st = GetStation(start); st != NULL; st = (st->index + 1 < GetStationPoolSize()) ? GetStation(st->index + 1) : NULL)
       
   152 #define FOR_ALL_STATIONS(st) FOR_ALL_STATIONS_FROM(st, 0)
   141 
   153 
   142 VARDEF bool _station_sort_dirty[MAX_PLAYERS];
   154 VARDEF bool _station_sort_dirty[MAX_PLAYERS];
   143 VARDEF bool _global_station_sort_dirty;
   155 VARDEF bool _global_station_sort_dirty;
   144 
   156 
   145 void GetProductionAroundTiles(uint *produced, uint tile, int w, int h, int rad);
   157 void GetProductionAroundTiles(uint *produced, uint tile, int w, int h, int rad);