Go to the documentation of this file.
10 #ifndef BASE_STATION_BASE_H
11 #define BASE_STATION_BASE_H
46 static bool ScanForStationTiles(StationID st_id,
int left_a,
int top_a,
int right_a,
int bottom_a);
112 inline const char *GetCachedName()
const
114 if (!this->name.empty())
return this->name.c_str();
115 if (this->cached_name.empty()) this->FillCachedName();
116 return this->cached_name.c_str();
174 void FillCachedName()
const;
181 template <
class T,
bool Tis_waypo
int>
262 return (
const T *)st;
StationFacility facilities
The facilities that this station has.
uint32 TileIndex
The index/ID of a Tile.
StationRect - used to track station spread out rectangle - cheaper than scanning whole map.
static Titem * Get(size_t index)
Returns Titem with given index.
virtual void GetTileArea(TileArea *ta, StationType type) const =0
Get the tile area for a given station type.
byte waiting_triggers
Waiting triggers (NewGRF) for this station.
Town * town
The town this station is associated with.
static BaseStation * GetByTile(TileIndex tile)
Get the base station belonging to a specific tile.
Class defining several overloaded accessors so we don't have to cast base stations that often.
uint8 localidx
Station ID within GRF of station.
Tindex index
Index of this pool item.
StationPool _station_pool
The pool of stations.
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.
Interface for SpriteGroup-s to access the gamestate.
@ FACIL_NONE
The station has no facilities at all.
static T * Get(size_t index)
Gets station with given index.
static bool IsValidID(size_t index)
Tests whether given index is a valid index for station of this type.
Owner
Enum for all companies/owners.
Owner owner
The owner of this station.
uint8 num_specs
Number of specs in the speclist.
virtual bool TileBelongsToRailStation(TileIndex tile) const =0
Check whether a specific tile belongs to this station.
StringID string_id
Default name (town area) of station.
uint8 cached_anim_triggers
NOSAVE: Combined animation trigger bitmask, used to determine if trigger processing should happen.
static Pool::IterateWrapper< T > Iterate(size_t from=0)
Returns an iterable ensemble of all valid stations of type T.
CargoTypes cached_cargo_triggers
NOSAVE: Combined cargo trigger bitmask.
uint32 grfid
GRF ID of this custom station.
StationType
Station types.
TrackedViewportSign sign
NOSAVE: Dimensions of sign.
Common return value for all commands.
TileArea train_station
Tile area the train 'station' part covers.
Specialised ViewportSign that tracks whether it is valid for entering into a Kdtree.
uint16 random_bits
Random bits assigned to this station.
StationRect rect
NOSAVE: Station spread out rectangle maintained by StationRect::xxx() functions.
static bool IsExpected(const BaseStation *st)
Helper for checking whether the given station is of this type.
int32 Date
The type to store our dates in.
Represents the covered area of e.g.
std::string name
Custom name.
DiagDirection
Enumeration for diagonal directions.
static T * From(BaseStation *st)
Converts a BaseStation to SpecializedStation with type checking.
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.
StationFacility
The facilities a station might be having.
@ FACIL_WAYPOINT
Station is a waypoint.
static const StationFacility EXPECTED_FACIL
Specialized type.
uint32 StringID
Numeric value that represents a string, independent of the selected language.
Base class for all pools.
static T * GetByTile(TileIndex tile)
Get the station belonging to a specific tile.
static StationID GetStationIndex(TileIndex t)
Get StationID from a tile.
std::string cached_name
NOSAVE: Cache of the resolved name of the station, if not using a custom name.
BaseStation(TileIndex tile)
Initialize the base station.
TileIndex xy
Base tile of the station.
Base class for all station-ish types.
byte delete_ctr
Delete counter. If greater than 0 then it is decremented until it reaches 0; the waypoint is then is ...
StationSpecList * speclist
List of station specs of this station.
static void PostDestructor(size_t index)
Invalidating of the JoinStation window has to be done after removing item from the pool.
static T * GetIfValid(size_t index)
Returns station if the index is a valid index for this station type.
static const TileIndex INVALID_TILE
The very nice invalid tile marker.
virtual uint32 GetNewGRFVariable(const struct ResolverObject &object, byte variable, byte parameter, bool *available) const =0
Helper function to get a NewGRF variable that isn't implemented by the base class.
bool IsInUse() const
Check whether the base station currently is in use; in use means that it is not scheduled for deletio...
static bool IsValidID(size_t index)
Tests whether given index can be used to get valid (non-nullptr) Titem.
virtual uint GetPlatformLength(TileIndex tile) const =0
Obtain the length of a platform.
virtual void UpdateVirtCoord()=0
Update the coordinated of the sign (as shown in the viewport).
Specification of a rectangle with absolute coordinates of all edges.
Base class for all PoolItems.
Date build_date
Date of construction.