Station Struct Reference

Station data structure. More...

#include <station_base.h>

Inheritance diagram for Station:

PoolItem< T, Tid, Tpool >

Public Member Functions

RoadStopGetPrimaryRoadStop (RoadStopType type) const
RoadStopGetPrimaryRoadStop (const Vehicle *v) const
 Get the primary road stop (the first road stop) that the given vehicle can load/unload.
const AirportFTAClassAirport () const
 Station (TileIndex tile=INVALID_TILE)
virtual ~Station ()
 Clean up a station by clearing vehicle orders and invalidating windows.
void AddFacility (byte new_facility_bit, TileIndex facil_xy)
 Called when new facility is built on the station.
void MarkDirty () const
 Mark the sign of a station dirty for repaint.
void MarkTilesDirty (bool cargo_change) const
 Marks the tiles of the station as dirty.
bool TileBelongsToRailStation (TileIndex tile) const
uint GetPlatformLength (TileIndex tile, DiagDirection dir) const
 Determines the REMAINING length of a platform, starting at (and including) the given tile.
uint GetPlatformLength (TileIndex tile) const
 Obtain the length of a platform.
bool IsBuoy () const
 Determines whether a station is a buoy only.
bool IsValid () const
 Determines whether a station exists.
uint GetCatchmentRadius () const
 Determines the catchment radius of the station.

Data Fields

TileIndex xy
RoadStopbus_stops
RoadStoptruck_stops
TileIndex train_tile
TileIndex airport_tile
TileIndex dock_tile
Town * town
char * name
 Custom name.
IndustryType indtype
 Industry type to get the name from.
StringID string_id
 Default name (town area) of station.
ViewportSign sign
uint16 had_vehicle_of_type
byte time_since_load
byte time_since_unload
byte delete_ctr
OwnerByte owner
byte facilities
byte airport_type
byte trainst_w
byte trainst_h
uint8 num_specs
 List of custom stations (StationSpecs) allocated to the station.
StationSpecList * speclist
Date build_date
 Date of construction.
uint64 airport_flags
 stores which blocks on the airport are taken. was 16 bit earlier on, then 32
byte last_vehicle_type
std::list< Vehicle * > loading_vehicles
GoodsEntry goods [NUM_CARGO]
 Goods at this station.
uint16 random_bits
byte waiting_triggers
uint8 cached_anim_triggers
 Combined animation trigger bitmask, used to determine if trigger processing should happen.
StationRect rect
 Station spread out rectangle (not saved) maintained by StationRect_xxx() functions.

Static Public Attributes

static const int cDebugCtorLevel = 5

Detailed Description

Station data structure.

Definition at line 113 of file station_base.h.


Constructor & Destructor Documentation

Station::~Station (  )  [virtual]

Clean up a station by clearing vehicle orders and invalidating windows.

Aircraft-Hangar orders need special treatment here, as the hangars are actually part of a station (tiletype is STATION), but the order type is OT_GOTO_DEPOT.

Definition at line 52 of file station.cpp.

References PoolItem< T, Tid, Tpool >::CleaningPool(), DeleteStationNews(), DeleteWindowById(), goods, PoolItem< T, Tid, Tpool >::index, INVALID_TILE, InvalidateWindowData(), IsNormalAircraft(), MarkDirty(), name, and RemoveOrderFromAllVehicles().


Member Function Documentation

RoadStop * Station::GetPrimaryRoadStop ( const Vehicle *  v  )  const

Get the primary road stop (the first road stop) that the given vehicle can load/unload.

Parameters:
v the vehicle to get the first road stop for
Returns:
the first roadstop that this vehicle can load at

Definition at line 106 of file station.cpp.

References CC_PASSENGERS, RoadStop::next, ROADSTOP_BUS, ROADSTOP_TRUCK, ROADTYPES_NONE, and RoadStop::xy.

void Station::AddFacility ( byte  new_facility_bit,
TileIndex  facil_xy 
)

Called when new facility is built on the station.

If it is the first facility it initializes also 'xy' and 'random_bits' members

Definition at line 125 of file station.cpp.

References _date, and build_date.

Referenced by CmdBuildAirport(), CmdBuildDock(), CmdBuildRailroadStation(), and CmdBuildRoadStop().

uint Station::GetPlatformLength ( TileIndex  tile,
DiagDirection  dir 
) const

Determines the REMAINING length of a platform, starting at (and including) the given tile.

Parameters:
tile the tile from which to start searching. Must be a railway station tile
dir The direction in which to search.
Returns:
The platform length

Definition at line 219 of file station.cpp.

References DIAGDIR_END, and TileOffsByDiagDir().

Referenced by LoadUnloadVehicle().

uint Station::GetPlatformLength ( TileIndex  tile  )  const

Obtain the length of a platform.

Precondition:
tile must be a railway station tile
Parameters:
tile A tile that contains the platform in question
Returns:
The length of the platform

Definition at line 189 of file station.cpp.

References AXIS_X, and TileDiffXY().

bool Station::IsBuoy (  )  const

Determines whether a station is a buoy only.

Todo:
Ditch this encoding of buoys

Definition at line 237 of file station.cpp.

Referenced by CompanyStationsWindow::BuildStationsList(), FindStationsAroundTiles(), CompanyStationsWindow::OnClick(), CompanyStationsWindow::OnPaint(), and UpdateStationAcceptance().

bool Station::IsValid (  )  const [inline]

Determines whether a station exists.

Returns:
true if and only is the station exists

Definition at line 202 of file station_base.h.

References INVALID_TILE.

Referenced by WhoCanServiceIndustry().

uint Station::GetCatchmentRadius (  )  const

Determines the catchment radius of the station.

Returns:
The radius

Definition at line 245 of file station.cpp.

References _settings_game, CA_UNMODIFIED, AirportFTAClass::catchment, INVALID_TILE, StationSettings::modified_catchment, and GameSettings::station.

Referenced by DeliverGoodsToIndustry(), FindStationsAroundTiles(), and UpdateStationAcceptance().


The documentation for this struct was generated from the following files:

Generated on Mon Mar 9 23:34:22 2009 for openttd by  doxygen 1.5.6