(svn r16861) -Codechange: move a few more bits from station to basestation (to be shared with waypoints)

This commit is contained in:
rubidium 2009-07-17 20:30:07 +00:00
parent 06ea681b5f
commit 72d6c3a9ad
2 changed files with 14 additions and 8 deletions

View File

@ -31,8 +31,14 @@
StationPool _station_pool("Station"); StationPool _station_pool("Station");
INSTANTIATE_POOL_METHODS(Station) INSTANTIATE_POOL_METHODS(Station)
BaseStation::~BaseStation()
{
free(this->name);
free(this->speclist);
}
Station::Station(TileIndex tile) : Station::Station(TileIndex tile) :
xy(tile), BaseStation(tile),
train_tile(INVALID_TILE), train_tile(INVALID_TILE),
airport_tile(INVALID_TILE), airport_tile(INVALID_TILE),
dock_tile(INVALID_TILE), dock_tile(INVALID_TILE),
@ -57,9 +63,6 @@ Station::Station(TileIndex tile) :
*/ */
Station::~Station() Station::~Station()
{ {
free(this->name);
free(this->speclist);
if (CleaningPool()) return; if (CleaningPool()) return;
while (!this->loading_vehicles.empty()) { while (!this->loading_vehicles.empty()) {

View File

@ -79,6 +79,10 @@ struct StationRect : public Rect {
/** Base class for all station-ish types */ /** Base class for all station-ish types */
struct BaseStation { struct BaseStation {
TileIndex xy; ///< Base tile of the station
ViewportSign sign; ///< NOSAVE: Dimensions of sign
byte delete_ctr; ///< Delete counter. If greater than 0 then it is decremented until it reaches 0; the waypoint is then is deleted.
char *name; ///< Custom name char *name; ///< Custom name
StringID string_id; ///< Default name (town area) of station StringID string_id; ///< Default name (town area) of station
@ -95,6 +99,9 @@ struct BaseStation {
byte waiting_triggers; ///< Waiting triggers (NewGRF) for this station byte waiting_triggers; ///< Waiting triggers (NewGRF) for this station
uint8 cached_anim_triggers; ///< NOSAVE: Combined animation trigger bitmask, used to determine if trigger processing should happen. uint8 cached_anim_triggers; ///< NOSAVE: Combined animation trigger bitmask, used to determine if trigger processing should happen.
BaseStation(TileIndex tile = INVALID_TILE) : xy(tile) { }
virtual ~BaseStation();
/** /**
* Check whether a specific tile belongs to this station. * Check whether a specific tile belongs to this station.
* @param tile the tile to check * @param tile the tile to check
@ -138,7 +145,6 @@ public:
return GetAirport(airport_type); return GetAirport(airport_type);
} }
TileIndex xy;
RoadStop *bus_stops; RoadStop *bus_stops;
RoadStop *truck_stops; RoadStop *truck_stops;
TileIndex train_tile; TileIndex train_tile;
@ -147,13 +153,10 @@ public:
IndustryType indtype; ///< Industry type to get the name from IndustryType indtype; ///< Industry type to get the name from
ViewportSign sign;
StationHadVehicleOfTypeByte had_vehicle_of_type; StationHadVehicleOfTypeByte had_vehicle_of_type;
byte time_since_load; byte time_since_load;
byte time_since_unload; byte time_since_unload;
byte delete_ctr;
byte airport_type; byte airport_type;
/* trainstation width/height */ /* trainstation width/height */