|
OpenTTD Source 20260311-master-g511d3794ce
|
Base class for all station-ish types. More...
#include <base_station_base.h>
Public Member Functions | |
| BaseStation (StationID index, TileIndex tile) | |
| Initialize the base station. | |
| virtual | ~BaseStation () |
| Ensure the destructor of the sub classes are called as well. | |
| virtual bool | TileBelongsToRailStation (TileIndex tile) const =0 |
| Check whether a specific tile belongs to this station. | |
| virtual uint32_t | GetNewGRFVariable (const struct ResolverObject &object, uint8_t variable, uint8_t parameter, bool &available) const =0 |
| Helper function to get a NewGRF variable that isn't implemented by the base class. | |
| virtual void | UpdateVirtCoord ()=0 |
| Update the coordinated of the sign (as shown in the viewport). | |
| const std::string & | GetCachedName () const |
| virtual void | MoveSign (TileIndex new_xy) |
| Move this station's main coordinate somewhere else. | |
| virtual TileArea | GetTileArea (StationType type) const =0 |
| Get the tile area for a given station type. | |
| virtual uint | GetPlatformLength (TileIndex tile) const =0 |
| Obtain the length of a platform. | |
| virtual uint | GetPlatformLength (TileIndex tile, DiagDirection dir) const =0 |
| Determines the REMAINING length of a platform, starting at (and including) the given tile. | |
| bool | IsInUse () const |
| Check whether the base station currently is in use; in use means that it is not scheduled for deletion and that it still has some facilities left. | |
| uint8_t | GetRoadStopRandomBits (TileIndex tile) const |
| uint8_t | GetRoadStopAnimationFrame (TileIndex tile) const |
| void | SetRoadStopRandomBits (TileIndex tile, uint8_t random_bits) |
| bool | SetRoadStopAnimationFrame (TileIndex tile, uint8_t frame) |
| void | RemoveRoadStopTileData (TileIndex tile) |
Static Public Member Functions | |
| static BaseStation * | GetByTile (TileIndex tile) |
| Get the base station belonging to a specific tile. | |
| static void | PostDestructor (size_t index) |
| Invalidating of the JoinStation window has to be done after removing item from the pool. | |
Data Fields | |
| TileIndex | xy = INVALID_TILE |
| Base tile of the station. | |
| TrackedViewportSign | sign {} |
| NOSAVE: Dimensions of sign. | |
| uint8_t | delete_ctr = 0 |
| Delete counter. If greater than 0 then it is decremented until it reaches 0; the waypoint is then is deleted. | |
| std::string | name {} |
| Custom name. | |
| StringID | string_id = INVALID_STRING_ID |
| Default name (town area) of station. | |
| std::string | cached_name |
| NOSAVE: Cache of the resolved name of the station, if not using a custom name. | |
| Town * | town = nullptr |
| The town this station is associated with. | |
| Owner | owner = INVALID_OWNER |
| The owner of this station. | |
| StationFacilities | facilities {} |
| The facilities that this station has. | |
| std::vector< SpecMapping< StationSpec > > | speclist {} |
| List of rail station specs of this station. | |
| std::vector< SpecMapping< RoadStopSpec > > | roadstop_speclist {} |
| List of road stop specs of this station. | |
| TimerGameCalendar::Date | build_date {} |
| Date of construction. | |
| uint16_t | random_bits = 0 |
| Random bits assigned to this station. | |
| std::unordered_map< TileIndex, StationRandomTriggers > | tile_waiting_random_triggers |
| StationRandomTriggers | waiting_random_triggers |
| Waiting triggers (NewGRF), shared by all station parts/tiles, road stops, ... essentially useless and broken by design. | |
| StationAnimationTriggers | cached_anim_triggers |
| NOSAVE: Combined animation trigger bitmask, used to determine if trigger processing should happen. | |
| StationAnimationTriggers | cached_roadstop_anim_triggers |
| NOSAVE: Combined animation trigger bitmask for road stops, used to determine if trigger processing should happen. | |
| CargoTypes | cached_cargo_triggers {} |
| NOSAVE: Combined cargo trigger bitmask. | |
| CargoTypes | cached_roadstop_cargo_triggers {} |
| NOSAVE: Combined cargo trigger bitmask for road stops. | |
| TileArea | train_station {INVALID_TILE, 0, 0} |
| Tile area the train 'station' part covers. | |
| StationRect | rect {} |
| NOSAVE: Station spread out rectangle maintained by StationRect::xxx() functions. | |
| std::vector< RoadStopTileData > | custom_roadstop_tile_data {} |
| List of custom road stop tile data. | |
Private Member Functions | |
| bool | SetRoadStopTileData (TileIndex tile, uint8_t data, bool animation) |
| void | FillCachedName () const |
Base class for all station-ish types.
Definition at line 58 of file base_station_base.h.
|
inline |
Initialize the base station.
| index | The index of the station within the pool. |
| tile | The location of the station sign |
Definition at line 94 of file base_station_base.h.
References xy.
Referenced by SpecializedStation< T, Tis_waypoint >::From(), SpecializedStation< T, Tis_waypoint >::From(), GetByTile(), SpecializedStation< T, Tis_waypoint >::IsExpected(), and SpecializedStation< T, Tis_waypoint >::SpecializedStation().
|
virtual |
Ensure the destructor of the sub classes are called as well.
Definition at line 52 of file station.cpp.
References CloseWindowById(), owner, sign, VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, VEH_TRAIN, VL_STATION_LIST, WC_AIRCRAFT_LIST, WC_ROADVEH_LIST, WC_SHIPS_LIST, and WC_TRAINS_LIST.
|
private |
Definition at line 489 of file station_cmd.cpp.
|
inlinestatic |
Get the base station belonging to a specific tile.
| tile | The tile to get the base station from. |
Definition at line 167 of file base_station_base.h.
References BaseStation(), and GetStationIndex().
Referenced by AfterLoadGame(), AircraftEventHandler_InHangar(), CFollowTrackT< TRANSPORT_WATER, Ship, true >::CanEnterNewTile(), CheckForDockingTile(), ClickTile_Station(), CmdBuildAircraft(), DisasterTick_Zeppeliner(), DrawTile_Station(), FloodVehicleProc(), FloodVehicles(), BuildVehicleWindow::GenerateBuildAircraftList(), RoadStop::GetByTile(), GetOrderCmdFromTile(), NIHRoadStop::GetParent(), NIHStation::GetParent(), GetTileDesc_Station(), RoadStopScopeResolver::GetVariable(), StationScopeResolver::GetVariable(), GetVehiclePosOnBuild(), IsHangar(), CYapfCostRailT< Types >::PfCalcCost(), RemoveAirport(), RemoveBuoy(), RemoveDock(), RemoveRailStation(), RemoveRailWaypoint(), RemoveRoadStop(), RemoveRoadWaypointStop(), CYapfReserveTrack< Types >::ReserveRailStationPlatform(), CYapfReserveTrack< Types >::ReserveSingleTrack(), NIHAirportTile::Resolve(), NIHStation::Resolve(), TileLoop_Station(), and TryReserveRailTrack().
|
inline |
Definition at line 121 of file base_station_base.h.
|
pure virtual |
Helper function to get a NewGRF variable that isn't implemented by the base class.
| object | the resolver object related to this query |
| variable | that is queried |
| parameter | parameter for that variable |
| available | will return false if ever the variable asked for does not exist |
Implemented in Waypoint.
|
pure virtual |
Obtain the length of a platform.
| tile | A tile that contains the platform in question |
Implemented in Station, and Waypoint.
Referenced by CFollowTrackT< TRANSPORT_WATER, Ship, true >::CanEnterNewTile(), and CYapfCostRailT< Types >::PfCalcCost().
|
pure virtual |
|
inline |
Definition at line 191 of file base_station_base.h.
|
inline |
Definition at line 183 of file base_station_base.h.
|
pure virtual |
Get the tile area for a given station type.
| type | the type of the area |
Implemented in Station, and Waypoint.
Referenced by CalcClosestStationTile(), and GetRailTileArea().
|
inline |
Check whether the base station currently is in use; in use means that it is not scheduled for deletion and that it still has some facilities left.
Definition at line 178 of file base_station_base.h.
References Airport, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Any(), BusStop, Dock, Train, and TruckStop.
Referenced by CmdBuildRailWaypoint(), CmdBuildRoadWaypoint(), DeleteStationIfEmpty(), WaypointWindow::GetCenterTile(), GetClosestDeletedStation(), WaypointWindow::OnInvalidateData(), WaypointWindow::OnPaint(), StationHandleBigTick(), and UpdateStationAcceptance().
|
inlinevirtual |
Move this station's main coordinate somewhere else.
| new_xy | New tile location of the sign. |
Reimplemented in Station, and Waypoint.
Definition at line 132 of file base_station_base.h.
References UpdateVirtCoord().
Referenced by Station::MoveSign(), and Waypoint::MoveSign().
|
static |
Invalidating of the JoinStation window has to be done after removing item from the pool.
Dummy function called after destructor of each member.
If you want to use it, override it in PoolItem's subclass.
| index | index of deleted item |
Definition at line 171 of file station.cpp.
References InvalidateWindowData(), and WC_SELECT_STATION.
| void BaseStation::RemoveRoadStopTileData | ( | TileIndex | tile | ) |
Definition at line 194 of file station.cpp.
|
inline |
Definition at line 204 of file base_station_base.h.
|
inline |
Definition at line 203 of file base_station_base.h.
|
private |
Definition at line 176 of file station.cpp.
|
pure virtual |
Check whether a specific tile belongs to this station.
| tile | the tile to check |
Implemented in Station, and Waypoint.
Referenced by DeallocateSpecFromStation(), StationUsesDefaultType(), and TriggerStationRandomisation().
|
pure virtual |
Update the coordinated of the sign (as shown in the viewport).
Implemented in Station, and Waypoint.
Referenced by MoveSign(), and RemoveFromRailBaseStation().
| TimerGameCalendar::Date BaseStation::build_date {} |
Date of construction.
Definition at line 74 of file base_station_base.h.
Referenced by Station::AddFacility(), CmdBuildBuoy(), CmdBuildRailWaypoint(), CmdBuildRoadWaypoint(), GetTileDesc_Station(), MoveBuoysToWaypoints(), and MoveWaypointsToBaseStations().
| StationAnimationTriggers BaseStation::cached_anim_triggers |
NOSAVE: Combined animation trigger bitmask, used to determine if trigger processing should happen.
Definition at line 79 of file base_station_base.h.
Referenced by CmdBuildRailStation(), DeallocateSpecFromStation(), and StationUpdateCachedTriggers().
| CargoTypes BaseStation::cached_cargo_triggers {} |
NOSAVE: Combined cargo trigger bitmask.
Definition at line 81 of file base_station_base.h.
Referenced by DeallocateSpecFromStation(), StationUpdateCachedTriggers(), and TriggerStationRandomisation().
|
mutable |
NOSAVE: Cache of the resolved name of the station, if not using a custom name.
Definition at line 65 of file base_station_base.h.
Referenced by CmdRenameStation().
| StationAnimationTriggers BaseStation::cached_roadstop_anim_triggers |
NOSAVE: Combined animation trigger bitmask for road stops, used to determine if trigger processing should happen.
Definition at line 80 of file base_station_base.h.
Referenced by CmdBuildRoadStop(), CmdBuildRoadWaypoint(), DeallocateSpecFromRoadStop(), and RoadStopUpdateCachedTriggers().
| CargoTypes BaseStation::cached_roadstop_cargo_triggers {} |
NOSAVE: Combined cargo trigger bitmask for road stops.
Definition at line 82 of file base_station_base.h.
Referenced by DeallocateSpecFromRoadStop(), RoadStopUpdateCachedTriggers(), and TriggerRoadStopRandomisation().
| std::vector<RoadStopTileData> BaseStation::custom_roadstop_tile_data {} |
List of custom road stop tile data.
Definition at line 87 of file base_station_base.h.
Referenced by DeallocateSpecFromRoadStop(), SlRoadStopTileData::GetVector(), and TriggerRoadStopRandomisation().
| uint8_t BaseStation::delete_ctr = 0 |
Delete counter. If greater than 0 then it is decremented until it reaches 0; the waypoint is then is deleted.
Definition at line 61 of file base_station_base.h.
Referenced by CmdBuildRailWaypoint(), CmdBuildRoadWaypoint(), DeleteStationIfEmpty(), MoveBuoysToWaypoints(), MoveWaypointsToBaseStations(), RemoveBuoy(), and StationHandleBigTick().
| StationFacilities BaseStation::facilities {} |
The facilities that this station has.
Definition at line 69 of file base_station_base.h.
Referenced by Station::AddFacility(), AirportMaintenanceCost(), CanVehicleUseStation(), ClickTile_Station(), CmdBuildAirport(), CmdBuildBuoy(), CmdBuildRailWaypoint(), CmdBuildRoadWaypoint(), CmdInsertOrder(), CmdOpenCloseAirport(), CompanyStationsWindow::DrawWidget(), SelectStationWindow< T >::DrawWidget(), SlStationNormal::FixPointers(), SlStationWaypoint::FixPointers(), GetOrderCmdFromTile(), Train::GetOrderStationLocation(), GetVehicleCannotUseStationReason(), StationViewWindow::GetWidgetString(), SpecializedStation< T, Tis_waypoint >::IsExpected(), Waypoint::IsSingleTile(), SlStationGoods::Load(), SlStationNormal::Load(), SlStationWaypoint::Load(), MoveBuoysToWaypoints(), MoveWaypointsToBaseStations(), StationViewWindow::OnPaint(), RemoveAirport(), RemoveBuoy(), RemoveDock(), RemoveFromRailBaseStation(), RemoveRoadStop(), RemoveRoadWaypointStop(), SlStationNormal::Save(), SlStationWaypoint::Save(), StationHandleBigTick(), CompanyStationsWindow::StationTypeSorter(), UpdateStationAcceptance(), Station::UpdateVirtCoord(), and SelectStationWindow< T >::UpdateWidgetSize().
| std::string BaseStation::name {} |
Custom name.
Definition at line 63 of file base_station_base.h.
Referenced by CmdRenameStation(), CmdRenameWaypoint(), FormatString(), MoveBuoysToWaypoints(), and MoveWaypointsToBaseStations().
| Owner BaseStation::owner = INVALID_OWNER |
The owner of this station.
Definition at line 68 of file base_station_base.h.
Referenced by Station::AddFacility(), LinkGraphOverlay::AddLinks(), AddNearbyStation(), AfterLoadGame(), Station::AfterStationTileSetChange(), AircraftEventHandler_Flying(), AirportMaintenanceCost(), CmdBuildAirport(), CmdBuildBuoy(), CmdBuildDock(), CmdBuildRailStation(), CmdBuildRailWaypoint(), CmdBuildRoadStop(), CmdBuildRoadWaypoint(), CmdInsertOrder(), CmdMoveStationName(), CmdMoveWaypointName(), CmdOpenCloseAirport(), CmdRenameStation(), CmdRenameWaypoint(), DeleteStationIfEmpty(), DeliverGoodsToIndustry(), StationViewWindow::DrawCargoRatings(), LinkGraphOverlay::DrawStationDots(), CompanyStationsWindow::DrawWidget(), OrderList::FreeChain(), GetClosestDeletedStation(), GetOrderCmdFromTile(), GetTileHighlightType(), OrderList::InsertOrderAt(), LoadUnloadVehicle(), MayLoadUnderExclusiveRights(), ModifyStationRatingAround(), MoveBuoysToWaypoints(), MoveWaypointsToBaseStations(), CompanyStationsWindow::OnClick(), StationViewWindow::OnClick(), WaypointWindow::OnClick(), StationViewWindow::OnPaint(), LinkGraphOverlay::RebuildCache(), RemoveAirport(), RemoveDock(), RemoveRoadStop(), RemoveRoadWaypointStop(), UpdateStationAcceptance(), UpdateStationRating(), UpdateTownRating(), WaypointWindow::WaypointWindow(), ~BaseStation(), and Station::~Station().
| uint16_t BaseStation::random_bits = 0 |
Random bits assigned to this station.
Definition at line 76 of file base_station_base.h.
Referenced by Station::AddFacility(), TriggerRoadStopRandomisation(), and TriggerStationRandomisation().
| StationRect BaseStation::rect {} |
NOSAVE: Station spread out rectangle maintained by StationRect::xxx() functions.
Definition at line 85 of file base_station_base.h.
Referenced by AddNearbyStation(), AfterLoadGame(), CheckSubsidised(), CmdBuildAirport(), CmdBuildBuoy(), CmdBuildDock(), CmdBuildRailStation(), CmdBuildRailWaypoint(), CmdBuildRoadStop(), CmdBuildRoadWaypoint(), CmdMoveStationName(), CmdMoveWaypointName(), Station::GetCatchmentRect(), SmallMapWindow::GetStationMiddle(), MoveBuoysToWaypoints(), MoveWaypointsToBaseStations(), LinkGraphOverlay::RebuildCache(), Station::RecomputeCatchment(), RemoveAirport(), RemoveBuoy(), RemoveDock(), RemoveRoadStop(), RemoveRoadWaypointStop(), and UpdateStationAcceptance().
| std::vector<SpecMapping<RoadStopSpec> > BaseStation::roadstop_speclist {} |
List of road stop specs of this station.
Definition at line 72 of file base_station_base.h.
Referenced by AllocateSpecToRoadStop(), AssignSpecToRoadStop(), DeallocateSpecFromRoadStop(), and RoadStopScopeResolver::GetVariable().
| TrackedViewportSign BaseStation::sign {} |
NOSAVE: Dimensions of sign.
Definition at line 60 of file base_station_base.h.
Referenced by Station::UpdateVirtCoord(), Waypoint::UpdateVirtCoord(), ~BaseStation(), Station::~Station(), and Waypoint::~Waypoint().
| std::vector<SpecMapping<StationSpec> > BaseStation::speclist {} |
List of rail station specs of this station.
Definition at line 71 of file base_station_base.h.
Referenced by AllocateSpecToStation(), AssignSpecToStation(), DeallocateSpecFromStation(), DrawTile_Station(), StationScopeResolver::GetVariable(), and Station::MarkTilesDirty().
| StringID BaseStation::string_id = INVALID_STRING_ID |
Default name (town area) of station.
Definition at line 64 of file base_station_base.h.
Referenced by CmdBuildBuoy(), CmdBuildRailWaypoint(), CmdBuildRoadWaypoint(), FormatString(), Waypoint::IsOfType(), MoveBuoysToWaypoints(), and MoveWaypointsToBaseStations().
| std::unordered_map<TileIndex, StationRandomTriggers> BaseStation::tile_waiting_random_triggers |
Definition at line 77 of file base_station_base.h.
| Town* BaseStation::town = nullptr |
The town this station is associated with.
Definition at line 67 of file base_station_base.h.
Referenced by AddCargoDelivery(), AfterLoadGame(), CmdBuildAirport(), CmdBuildBuoy(), CmdBuildRailWaypoint(), CmdBuildRoadWaypoint(), DeliverGoods(), StationViewWindow::DrawCargoRatings(), EncodeCargoTownMonitor(), FormatString(), GenerateStationName(), MayLoadUnderExclusiveRights(), MoveBuoysToWaypoints(), MoveWaypointsToBaseStations(), and UpdateStationRating().
| TileArea BaseStation::train_station {INVALID_TILE, 0, 0} |
Tile area the train 'station' part covers.
Definition at line 84 of file base_station_base.h.
Referenced by AfterLoadGame(), CanExpandRailStation(), CmdBuildRailStation(), CmdBuildRailWaypoint(), CmdRemoveFromRailStation(), Station::GetCatchmentRadius(), Station::GetTileArea(), Waypoint::GetTileArea(), Waypoint::IsSingleTile(), Station::MarkTilesDirty(), MoveBuoysToWaypoints(), Train::OnNewEconomyDay(), RemoveFromRailBaseStation(), StationResolverObject::ResolveReal(), and StationUsesDefaultType().
| StationRandomTriggers BaseStation::waiting_random_triggers |
Waiting triggers (NewGRF), shared by all station parts/tiles, road stops, ... essentially useless and broken by design.
Definition at line 78 of file base_station_base.h.
Referenced by TriggerRoadStopRandomisation(), and TriggerStationRandomisation().
| TileIndex BaseStation::xy = INVALID_TILE |
Base tile of the station.
Definition at line 59 of file base_station_base.h.
Referenced by Station::AddIndustryToDeliver(), LinkGraph::AddNode(), CargoPacket::AfterLoad(), AfterLoadLinkGraphs(), AircraftController(), AircraftGetEntryPoint(), BaseStation(), CalcClosestStationTile(), CmdBuildBuoy(), CmdBuildRailWaypoint(), CmdBuildRoadWaypoint(), CmdMoveStationName(), CmdMoveWaypointName(), DeleteStaleLinks(), CompanyStationsWindow::DrawWidget(), Aircraft::FindClosestDepot(), WaypointWindow::GetCenterTile(), GetClosestDeletedStation(), Order::GetLocation(), RoadVehicle::GetOrderStationLocation(), Ship::GetOrderStationLocation(), Train::GetOrderStationLocation(), GetReferenceTile(), Waypoint::GetTileArea(), LoadUnloadVehicle(), ModifyStationRatingAround(), Station::MoveSign(), Waypoint::MoveSign(), CompanyStationsWindow::OnClick(), LinkRefresher::RefreshStats(), Station::UpdateVirtCoord(), and Waypoint::UpdateVirtCoord().