10 #ifndef BASE_STATION_BASE_H
11 #define BASE_STATION_BASE_H
32 uint8_t animation_frame;
53 static bool ScanForStationTiles(StationID st_id,
int left_a,
int top_a,
int right_a,
int bottom_a);
72 std::vector<SpecMapping<StationSpec>>
speclist;
123 inline const std::string &GetCachedName()
const
125 if (!this->name.empty())
return this->
name;
126 if (this->cached_name.empty()) this->FillCachedName();
182 inline uint8_t GetRoadStopRandomBits(
TileIndex tile)
const
185 if (tile_data.tile == tile)
return tile_data.random_bits;
190 inline uint8_t GetRoadStopAnimationFrame(
TileIndex tile)
const
193 if (tile_data.tile == tile)
return tile_data.animation_frame;
199 bool SetRoadStopTileData(
TileIndex tile, uint8_t data,
bool animation);
203 inline bool SetRoadStopAnimationFrame(
TileIndex tile, uint8_t frame) {
return this->SetRoadStopTileData(tile, frame,
true); }
204 void RemoveRoadStopTileData(
TileIndex tile);
209 void FillCachedName()
const;
216 template <
class T,
bool Tis_waypo
int>
297 return (
const T *)st;
315 template <>
inline std::vector<SpecMapping<StationSpec>> &GetStationSpecList<StationSpec>(
BaseStation *bst) {
return bst->
speclist; }
316 template <>
inline std::vector<SpecMapping<RoadStopSpec>> &GetStationSpecList<RoadStopSpec>(
BaseStation *bst) {
return bst->
roadstop_speclist; }
std::vector< SpecMapping< T > > & GetStationSpecList(BaseStation *bst)
Get spec mapping list for each supported custom spec type.
Common return value for all commands.
Types related to commands.
Owner
Enum for all companies/owners.
DiagDirection
Enumeration for diagonal directions.
Definition of Pool, structure used to access PoolItems, and PoolItem, base structure for Vehicle,...
StationPool _station_pool("Station")
The pool of stations.
Maps accessors for stations.
StationID GetStationIndex(Tile t)
Get StationID from a tile.
StationFacility
The facilities a station might be having.
@ FACIL_WAYPOINT
Station is a waypoint.
@ FACIL_NONE
The station has no facilities at all.
StationType
Station types.
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
Base class for all station-ish types.
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.
StationFacility facilities
The facilities that this station has.
std::vector< SpecMapping< RoadStopSpec > > roadstop_speclist
List of road stop specs of this station.
virtual uint GetPlatformLength(TileIndex tile) const =0
Obtain the length of a platform.
StringID string_id
Default name (town area) of station.
TileIndex xy
Base tile of the station.
std::vector< SpecMapping< StationSpec > > speclist
List of rail station specs of this station.
uint8_t cached_anim_triggers
NOSAVE: Combined animation trigger bitmask, used to determine if trigger processing should happen.
std::string cached_name
NOSAVE: Cache of the resolved name of the station, if not using a custom name.
TileArea train_station
Tile area the train 'station' part covers.
virtual uint GetPlatformLength(TileIndex tile, DiagDirection dir) const =0
Determines the REMAINING length of a platform, starting at (and including) the given tile.
uint8_t cached_roadstop_anim_triggers
NOSAVE: Combined animation trigger bitmask for road stops, used to determine if trigger processing sh...
Owner owner
The owner of this station.
virtual void GetTileArea(TileArea *ta, StationType type) const =0
Get the tile area for a given station type.
virtual void UpdateVirtCoord()=0
Update the coordinated of the sign (as shown in the viewport).
uint8_t delete_ctr
Delete counter. If greater than 0 then it is decremented until it reaches 0; the waypoint is then is ...
StationRect rect
NOSAVE: Station spread out rectangle maintained by StationRect::xxx() functions.
static void PostDestructor(size_t index)
Invalidating of the JoinStation window has to be done after removing item from the pool.
bool IsInUse() const
Check whether the base station currently is in use; in use means that it is not scheduled for deletio...
BaseStation(TileIndex tile)
Initialize the base station.
Town * town
The town this station is associated with.
virtual bool TileBelongsToRailStation(TileIndex tile) const =0
Check whether a specific tile belongs to this station.
CargoTypes cached_roadstop_cargo_triggers
NOSAVE: Combined cargo trigger bitmask for road stops.
uint16_t random_bits
Random bits assigned to this station.
TrackedViewportSign sign
NOSAVE: Dimensions of sign.
static BaseStation * GetByTile(TileIndex tile)
Get the base station belonging to a specific tile.
std::vector< RoadStopTileData > custom_roadstop_tile_data
List of custom road stop tile data.
uint8_t waiting_triggers
Waiting triggers (NewGRF) for this station.
TimerGameCalendar::Date build_date
Date of construction.
std::string name
Custom name.
CargoTypes cached_cargo_triggers
NOSAVE: Combined cargo trigger bitmask.
Represents the covered area of e.g.
Base class for all PoolItems.
Tindex index
Index of this pool item.
static Titem * Get(size_t index)
Returns Titem with given index.
static bool IsValidID(size_t index)
Tests whether given index can be used to get valid (non-nullptr) Titem.
Base class for all pools.
Specification of a rectangle with absolute coordinates of all edges.
Interface for SpriteGroup-s to access the gamestate.
const T * spec
Custom spec.
uint32_t grfid
GRF ID of this custom spec.
uint16_t localidx
Local ID within GRF of this custom spec.
Class defining several overloaded accessors so we don't have to cast base stations that often.
static T * GetIfValid(size_t index)
Returns station if the index is a valid index for this station type.
static const StationFacility EXPECTED_FACIL
Specialized type.
static Pool::IterateWrapper< T > Iterate(size_t from=0)
Returns an iterable ensemble of all valid stations of type T.
static bool IsExpected(const BaseStation *st)
Helper for checking whether the given station is of this type.
static T * Get(size_t index)
Gets station with given index.
static T * GetByTile(TileIndex tile)
Get the station belonging to a specific tile.
SpecializedStation(TileIndex tile)
Set station type correctly.
static bool IsValidID(size_t index)
Tests whether given index is a valid index for station of this type.
static T * From(BaseStation *st)
Converts a BaseStation to SpecializedStation with type checking.
StationRect - used to track station spread out rectangle - cheaper than scanning whole map.
static bool ScanForStationTiles(StationID st_id, int left_a, int top_a, int right_a, int bottom_a)
Check whether station tiles of the given station id exist in the given rectangle.
bool PtInExtendedRect(int x, int y, int distance=0) const
Determines whether a given point (x, y) is within a certain distance of the station rectangle.
Specialised ViewportSign that tracks whether it is valid for entering into a Kdtree.
constexpr TileIndex INVALID_TILE
The very nice invalid tile marker.
Definition of the game-calendar-timer.
Types related to viewports.