|
OpenTTD Source
14.0-beta1
|
Go to the documentation of this file.
10 #ifndef BASE_STATION_BASE_H
11 #define BASE_STATION_BASE_H
37 uint8_t animation_frame;
58 static bool ScanForStationTiles(StationID st_id,
int left_a,
int top_a,
int right_a,
int bottom_a);
128 inline const std::string &GetCachedName()
const
130 if (!this->name.empty())
return this->
name;
131 if (this->cached_name.empty()) this->FillCachedName();
187 inline byte GetRoadStopRandomBits(
TileIndex tile)
const
190 if (tile_data.tile == tile)
return tile_data.random_bits;
195 inline byte GetRoadStopAnimationFrame(
TileIndex tile)
const
198 if (tile_data.tile == tile)
return tile_data.animation_frame;
204 void SetRoadStopTileData(
TileIndex tile,
byte data,
bool animation);
208 inline void SetRoadStopAnimationFrame(
TileIndex tile,
byte frame) { this->SetRoadStopTileData(tile, frame,
true); }
209 void RemoveRoadStopTileData(
TileIndex tile);
214 void FillCachedName()
const;
221 template <
class T,
bool Tis_waypo
int>
302 return (
const T *)st;
StationFacility facilities
The facilities that this station has.
std::vector< StationSpecList > speclist
List of rail station specs of this station.
StationRect - used to track station spread out rectangle - cheaper than scanning whole map.
CargoTypes cached_roadstop_cargo_triggers
NOSAVE: Combined cargo trigger bitmask for road stops.
static Titem * Get(size_t index)
Returns Titem with given index.
uint32_t grfid
GRF ID of this custom station.
std::vector< RoadStopSpecList > roadstop_speclist
List of road stop specs of this station.
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.
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
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.
constexpr TileIndex INVALID_TILE
The very nice invalid tile marker.
@ 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.
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.
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.
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.
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.
Represents the covered area of e.g.
virtual uint32_t 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.
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_t grfid
GRF ID of this custom road stop.
Base class for all pools.
StationID GetStationIndex(Tile t)
Get StationID from a tile.
static T * GetByTile(TileIndex tile)
Get the station belonging to a specific 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.
uint8_t cached_anim_triggers
NOSAVE: Combined animation trigger bitmask, used to determine if trigger processing should happen.
byte delete_ctr
Delete counter. If greater than 0 then it is decremented until it reaches 0; the waypoint is then is ...
uint16_t random_bits
Random bits assigned to this station.
uint16_t localidx
Station ID within GRF of station.
uint8_t cached_roadstop_anim_triggers
NOSAVE: Combined animation trigger bitmask for road stops, used to determine if trigger processing sh...
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.
uint16_t localidx
Station ID within GRF of road stop.
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.
std::vector< RoadStopTileData > custom_roadstop_tile_data
List of custom road stop tile data.
Base class for all PoolItems.
TimerGameCalendar::Date build_date
Date of construction.