OpenTTD Source
20240915-master-g3784a3d3d6
|
Go to the documentation of this file.
62 default: NOT_REACHED();
109 Swap(platforms, length);
118 SB(retval, 0, 4, y & 0xF);
119 SB(retval, 4, 4, x & 0xF);
121 SB(retval, 0, 4, std::min(15, y));
122 SB(retval, 4, 4, std::min(15, length - y - 1));
123 SB(retval, 8, 4, std::min(15, x));
124 SB(retval, 12, 4, std::min(15, platforms - x - 1));
126 SB(retval, 16, 4, std::min(15, length));
127 SB(retval, 20, 4, std::min(15, platforms));
128 SB(retval, 24, 8, tile);
144 uint8_t orig_type = 0;
165 static uint32_t GetPlatformInfoHelper(
TileIndex tile,
bool check_type,
bool check_axis,
bool centred)
167 int tx =
TileX(tile);
168 int ty =
TileY(tile);
181 static uint32_t GetRailContinuationInfo(
TileIndex tile)
200 for (i = 0; i <
lengthof(x_dir); i++, dir++, diagdir++) {
264 if (t ==
nullptr)
return nullptr;
272 if (this->
st ==
nullptr) {
279 case 0x49:
return 0x2110000;
289 bool swap = (this->axis ==
AXIS_Y &&
HasBit(tileh, CORNER_W) !=
HasBit(tileh, CORNER_E));
305 if (!
HasBit(
_svc.valid, 0)) {
_svc.v40 = GetPlatformInfoHelper(this->tile,
false,
false,
false);
SetBit(
_svc.valid, 0); }
309 if (!
HasBit(
_svc.valid, 1)) {
_svc.v41 = GetPlatformInfoHelper(this->tile,
true,
false,
false);
SetBit(
_svc.valid, 1); }
320 if (!
HasBit(
_svc.valid, 3)) {
_svc.v46 = GetPlatformInfoHelper(this->tile,
false,
false,
true);
SetBit(
_svc.valid, 3); }
324 if (!
HasBit(
_svc.valid, 4)) {
_svc.v47 = GetPlatformInfoHelper(this->tile,
true,
false,
true);
SetBit(
_svc.valid, 4); }
328 if (!
HasBit(
_svc.valid, 5)) {
_svc.v49 = GetPlatformInfoHelper(this->tile,
false,
true,
false);
SetBit(
_svc.valid, 5); }
361 uint32_t res =
GB(
GetStationGfx(nearby_tile), 1, 2) << 12 | !!perpendicular << 11 | !!same_station << 10;
365 res |= 1 << (sm.grfid != grfid ? 9 : 8) | ClampTo<uint8_t>(sm.localidx);
389 if (sm.grfid == grfid) {
397 case 0x82:
return 50;
407 uint32_t Station::GetNewGRFVariable(
const ResolverObject &
object, uint8_t variable, uint8_t parameter,
bool &available)
const
415 case 0x8A:
return this->had_vehicle_of_type;
424 if ((variable >= 0x60 && variable <= 0x65) || variable == 0x69) {
429 case 0x62:
return 0xFFFFFFFF;
430 case 0x64:
return 0xFF00;
453 if (variable >= 0x8C && variable <= 0xEC) {
455 switch (
GB(variable - 0x8C, 0, 3)) {
467 Debug(grf, 1,
"Unhandled station variable 0x{:X}", variable);
486 if (variable >= 0x60 && variable <= 0x65) {
491 if (variable >= 0x8C && variable <= 0xEC) {
492 switch (
GB(variable - 0x8C, 0, 3)) {
493 case 3:
return INITIAL_STATION_RATING;
494 case 4:
return INVALID_STATION;
499 Debug(grf, 1,
"Unhandled station variable 0x{:X}", variable);
533 cargo = std::min(0xfffu, cargo);
541 if (!group->
loaded.empty()) {
543 return group->
loaded[set];
570 CallbackID callback, uint32_t callback_param1, uint32_t callback_param2)
571 :
ResolverObject(statspec->grf_prop.grffile, callback, callback_param1, callback_param2),
572 station_scope(*this, statspec, base_station, tile)
615 if (group ==
nullptr || group->type != SGT_RESULT)
return 0;
616 return group->GetResult() - 0x42D;
634 if (group ==
nullptr || group->type != SGT_RESULT)
return 0;
644 return object.ResolveCallback();
665 object.station_scope.axis = axis;
667 uint16_t cb_res =
object.ResolveCallback();
689 if (statspec ==
nullptr || st ==
nullptr)
return 0;
702 if (st->
speclist[i].spec == statspec)
return i;
730 if (specindex == 0)
return;
741 st->
speclist[specindex].spec =
nullptr;
743 st->
speclist[specindex].localidx = 0;
746 if (specindex == st->
speclist.size() - 1) {
748 for (num_specs = st->
speclist.size() - 1; num_specs > 0; num_specs--) {
749 if (st->
speclist[num_specs].grfid != 0)
break;
783 if (statspec ==
nullptr)
return false;
791 uint32_t relocation = 0;
792 uint32_t ground_relocation = 0;
799 layout = &statspec->
renderdata[(tile < statspec->
renderdata.size()) ? tile + axis : (uint)axis];
806 if (layout !=
nullptr) {
816 sprites = &tmp_rail_layout;
833 DrawSprite(ground + overlay_offset, PAL_NONE, x, y);
852 return specindex < st->
speclist.size() ? st->
speclist[specindex].spec :
nullptr;
858 return GetStationCallback(callback, param1, param2, statspec, st, tile);
873 if (ss ==
nullptr)
return;
881 static const TriggerArea tas[] = {
882 TA_TILE, TA_WHOLE, TA_WHOLE, TA_PLATFORM, TA_PLATFORM, TA_PLATFORM, TA_WHOLE
892 uint16_t random_bits = Random();
902 cargo = INVALID_CARGO;
922 static const TriggerArea tas[] = {
923 TA_WHOLE, TA_WHOLE, TA_PLATFORM, TA_PLATFORM, TA_PLATFORM, TA_PLATFORM
934 uint32_t whole_reseed = 0;
942 uint32_t used_triggers = 0;
948 if (ss ==
nullptr)
continue;
961 if (group ==
nullptr)
continue;
963 used_triggers |=
object.used_triggers;
965 uint32_t reseed =
object.GetReseedSum();
967 whole_reseed |= reseed;
972 random_bits &= ~reseed;
973 random_bits |= Random() & reseed;
984 if ((whole_reseed & 0xFFFF) != 0) {
1001 for (
const auto &sm : GetStationSpecList<StationSpec>(st)) {
1002 if (sm.spec ==
nullptr)
continue;
int AllocateSpecToStation(const StationSpec *statspec, BaseStation *st, bool exec)
Allocate a StationSpec to a Station.
TrackBits DiagdirReachesTracks(DiagDirection diagdir)
Returns all tracks that can be reached when entering a tile from a given (diagonal) direction.
static debug_inline uint TileY(TileIndex tile)
Get the Y component of a tile.
StationFacility facilities
The facilities that this station has.
TileIndexDiff TileOffsByDir(Direction dir)
Convert a Direction to a TileIndexDiff.
bool SplitGroundSpriteForOverlay(const TileInfo *ti, SpriteID *ground, RailTrackOffset *overlay_offset)
Check whether a sprite is a track sprite, which can be replaced by a non-track ground sprite and a ra...
@ DIAGDIR_NE
Northeast, upper right on your monitor.
PaletteID GroundSpritePaletteTransform(SpriteID image, PaletteID pal, PaletteID default_pal)
Applies PALETTE_MODIFIER_COLOUR to a palette entry of a ground sprite.
CargoID cargo_type
Type of cargo of the station.
uint64_t flags
stores which blocks on the airport are taken. was 16 bit earlier on, then 32
GoodsEntry goods[NUM_CARGO]
Goods at this station.
constexpr TileIndex TileAdd(TileIndex tile, TileIndexDiff offset)
Adds a given offset to a tile.
uint8_t rating
Station rating for this cargo.
constexpr T SetBit(T &x, const uint8_t y)
Set a bit in a variable.
static constexpr TimerGame< struct Calendar >::Date DAYS_TILL_ORIGINAL_BASE_YEAR
The date of the first day of the original base year.
std::vector< NewGRFSpriteLayout > renderdata
Number of tile layouts.
const DrawTileSprites * GetStationTileLayout(StationType st, uint8_t gfx)
Get station tile layout for a station type and its station gfx.
constexpr void Swap(T &a, T &b)
Type safe swap operation.
std::optional< TownScopeResolver > town_scope
The town scope resolver (created on the first call).
const RailTypeInfo * GetRailTypeInfo(RailType railtype)
Returns a pointer to the Railtype information for a given railtype.
uint GetRailtypeSpriteOffset() const
Offset between the current railtype and normal rail.
Town * ClosestTownFromTile(TileIndex tile, uint threshold)
Return the town closest (in distance or ownership) to a given tile, within a given threshold.
virtual void GetTileArea(TileArea *ta, StationType type) const =0
Get the tile area for a given station type.
StationRandomTrigger
Randomisation triggers for stations.
Town * town
The town this station is associated with.
static BaseStation * GetByTile(TileIndex tile)
Get the base station belonging to a specific tile.
Slope GetTileSlope(TileIndex tile)
Return the slope of a given tile inside the map.
uint8_t callback_mask
Bitmask of station callbacks that have to be called.
uint16_t triggers
The triggers that trigger animation.
@ SSF_DIV_BY_STATION_SIZE
Divide cargo amount by station size.
constexpr static debug_inline uint GB(const T x, const uint8_t s, const uint8_t n)
Fetch n bits from x, started at bit s.
RailType
Enumeration for all possible railtypes.
uint8_t flags
Bitmask of flags, bit 0: use different sprite set; bit 1: divide cargo about by station size.
uint32_t GetRegister(uint i)
Gets the value of a so-called newgrf "register".
uint8_t valid
Bits indicating what variable is valid (for each bit, 0 is invalid, 1 is valid).
uint32_t GetPlatformInfo(Axis axis, uint8_t tile, int platforms, int length, int x, int y, bool centred)
Evaluate a tile's position within a station, and return the result in a bit-stuffed format.
CargoTypes GetAcceptanceMask(const Station *st)
Get a mask of the cargo types that the station accepts.
SpriteID sprite
The 'real' sprite.
Interface for SpriteGroup-s to access the gamestate.
constexpr TileIndex INVALID_TILE
The very nice invalid tile marker.
const GRFFile * grffile
GRFFile the resolved SpriteGroup belongs to.
This struct contains all the info that is needed to draw and construct tracks.
uint16_t GetAnimStationCallback(CallbackID callback, uint32_t param1, uint32_t param2, const StationSpec *statspec, BaseStation *st, TileIndex tile, int)
Wrapper for animation control, see GetStationCallback.
const struct StationSpec * statspec
Station (type) specification.
bool IsCompatibleTrainStationTile(Tile test_tile, Tile station_tile)
Check if a tile is a valid continuation to a railstation tile.
bool IsRailStationTile(Tile t)
Is this tile a station tile and a rail station?
DiagDirection
Enumeration for diagonal directions.
static IterateWrapper Iterate(size_t from=0)
Returns an iterable ensemble of all valid CargoSpec.
@ CBM_STATION_ANIMATION_NEXT_FRAME
Use a custom next frame callback.
void DrawRailTileSeqInGUI(int x, int y, const DrawTileSprites *dts, int32_t total_offset, uint32_t newgrf_offset, PaletteID default_palette)
Draw tile sprite sequence in GUI with railroad specifics.
Specification of a cargo type.
uint32_t GetTerrainType(TileIndex tile, TileContext context)
Function used by houses (and soon industries) to get information on type of "terrain" the tile it is ...
uint8_t status
Status of this cargo, see GoodsEntryStatus.
CallbackID
List of implemented NewGRF callbacks.
static void InsertDefaults()
Initialise the defaults.
uint32_t GetTriggers() const override
Get the triggers.
@ SLOPE_EW
east and west corner are raised
void ProcessRegisters(uint8_t resolved_var10, uint32_t resolved_sprite, bool separate_ground) const
Evaluates the register modifiers and integrates them into the preprocessed sprite layout.
RailType GetRailType(Tile t)
Gets the rail type of the given tile.
bool IsUIAvailable(uint index) const
Check whether the spec will be available to the user at some point in time.
StationScopeResolver station_scope
The station scope resolver.
TownScopeResolver * GetTown()
Get the town scope associated with a station, if it exists.
@ CBID_STATION_DRAW_TILE_LAYOUT
Choose a tile layout to draw, instead of the standard range.
uint32_t PaletteID
The number of the palette.
Owner owner
The owner of this station.
static const uint NUM_STATIONSSPECS_PER_STATION
Maximum number of parts per station.
SpriteID GetCustomStationRelocation(const StationSpec *statspec, BaseStation *st, TileIndex tile, uint32_t var10)
Resolve sprites for drawing a station tile.
StringID name
Name of this class.
Axis GetRailStationAxis(Tile t)
Get the rail direction of a rail station.
uint16_t h
The height of the area.
uint8_t time_since_pickup
Number of rating-intervals (up to 255) since the last vehicle tried to load this cargo.
#define Debug(category, level, format_string,...)
Ouptut a line of debugging information.
uint TotalCount() const
Returns total count of cargo at the station, including cargo which is already reserved for loading.
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.
TrackStatus GetTileTrackStatus(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side)
Returns information about trackdirs and signal states.
CargoTypes cached_cargo_triggers
NOSAVE: Combined cargo trigger bitmask.
@ SSF_SEPARATE_GROUND
Use different sprite set for ground sprites.
@ SSF_CB141_RANDOM_BITS
Callback 141 needs random bits.
@ TRACK_BIT_NONE
No track.
@ CBM_STATION_DRAW_TILE_LAYOUT
Use callback to select a tile layout to use when drawing.
StationCargoList cargo
The cargo packets of cargo waiting in this station.
PalSpriteID ground
Palette and sprite for the ground.
std::vector< const SpriteGroup * > loading
List of loading groups (can be SpriteIDs or Callback results)
StationResolverObject(const StationSpec *statspec, BaseStation *st, TileIndex tile, CallbackID callback=CBID_NO_CALLBACK, uint32_t callback_param1=0, uint32_t callback_param2=0)
Resolver for stations.
CommandCost PerformStationTileSlopeCheck(TileIndex north_tile, TileIndex cur_tile, const StationSpec *statspec, Axis axis, uint8_t plat_len, uint8_t numtracks)
Check the slope of a tile of a new station.
StationCallbackMask
Callback masks for stations.
StationGfx GetStationGfx(Tile t)
Get the station graphics of this tile.
Common return value for all commands.
@ CBID_STATION_LAND_SLOPE_CHECK
Callback done for each tile of a station to check the slope.
Iterable ensemble of each set bit in a value.
@ GES_EVER_ACCEPTED
Set when a vehicle ever delivered cargo to the station for final delivery.
TileArea train_station
Tile area the train 'station' part covers.
uint32_t GetCompanyInfo(CompanyID owner, const Livery *l)
Returns company information like in vehicle var 43 or station var 43.
TrackBits
Allow incrementing of Track variables.
@ CBM_STATION_ANIMATION_SPEED
Customize the animation speed of the station.
bool HasRating() const
Does this cargo have a rating at this station?
uint8_t GetStationTileRandomBits(Tile t)
Get the random bits of a station tile.
@ CBID_NO_CALLBACK
Set when using the callback resolve system, but not to resolve a callback.
const SpriteGroup * root_spritegroup
Root SpriteGroup to use for resolving.
@ GES_ACCEPTED_BIGTICK
Set when cargo was delivered for final delivery during the current STATION_ACCEPTANCE_TICKS interval.
static bool IsExpected(const BaseStation *st)
Helper for checking whether the given station is of this type.
uint8_t fallback_railtype
Original railtype number to use when drawing non-newgrf railtypes, or when drawing stations.
Airport airport
Tile area the airport covers.
Represents the covered area of e.g.
DiagDirection AxisToDiagDir(Axis a)
Converts an Axis to a DiagDirection.
static constexpr CargoID SG_DEFAULT
Default type used when no more-specific cargo matches.
bool TileBelongsToRailStation(TileIndex tile) const override
Check whether a specific tile belongs to this station.
@ INVALID_AXIS
Flag for an invalid Axis.
bool HasStationTileRail(Tile t)
Has this station tile a rail? In other words, is this station tile a rail station or rail waypoint?
CargoTypes GetEmptyMask(const Station *st)
Get a mask of the cargo types that are empty at the station.
TileIndexDiff TileDiffXY(int x, int y)
Calculates an offset for the given coordinate(-offset).
uint16_t cargo_threshold
Cargo threshold for choosing between little and lots of cargo.
uint32_t GetNearbyTileInformation(TileIndex tile, bool grf_version8)
Common part of station var 0x67, house var 0x62, indtile var 0x60, industry var 0x62.
TTDPAirportType ttd_airport_type
ttdpatch airport type (Small/Large/Helipad/Oilrig)
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
NewGRF supplied spritelayout.
bool NeedsPreprocessing() const
Tests whether this spritelayout needs preprocessing by PrepareLayout() and ProcessRegisters(),...
#define lengthof(array)
Return the length of an fixed size array.
@ SPRITE_MODIFIER_CUSTOM_SPRITE
Set when a sprite originates from an Action 1.
Ground palette sprite of a tile, together with its sprite layout.
void DrawSprite(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub, ZoomLevel zoom)
Draw a sprite, not in a viewport.
static void ChangeAnimationFrame(CallbackID cb, const StationSpec *spec, BaseStation *obj, TileIndex tile, uint32_t random_bits, uint32_t trigger, int extra_data=0)
Check a callback to determine what the next animation step is and execute that step.
@ MP_TUNNELBRIDGE
Tunnel entry/exit and bridge heads.
@ RTSG_GROUND
Main group of ground images.
Scope resolver for a town.
void DeallocateSpecFromStation(BaseStation *st, uint8_t specindex)
Deallocate a StationSpec from a Station.
int32_t TileIndexDiff
An offset value between two tiles.
CommandCost GetErrorMessageFromLocationCallbackResult(uint16_t cb_res, const GRFFile *grffile, StringID default_error)
Get the error message from a shape/location/slope check callback result.
uint32_t GetDebugID() const override
Get an identifier for the item being resolved.
TileIndex GetNearbyTile(uint8_t parameter, TileIndex tile, bool signed_offsets, Axis axis)
Get the tile at the given offset.
static Station * From(BaseStation *st)
Converts a BaseStation to SpecializedStation with type checking.
uint PeriodsInTransit() const
Returns average number of cargo aging periods in transit for a cargo entity.
const Tspec * GetSpec(uint index) const
Get a spec from the class at a given index.
TrackBits TrackStatusToTrackBits(TrackStatus ts)
Returns the present-track-information of a TrackStatus.
@ CBID_STATION_ANIM_NEXT_FRAME
Called to determine station tile next animation frame.
RoadStop * truck_stops
All the truck stops.
const SpriteGroup * ResolveReal(const RealSpriteGroup *group) const override
Get the real sprites of the grf.
uint32_t PrepareLayout(uint32_t orig_offset, uint32_t newgrf_ground_offset, uint32_t newgrf_offset, uint constr_stage, bool separate_ground) const
Prepares a sprite layout before resolving action-1-2-3 chains.
uint32_t SpriteID
The number of a sprite, without mapping bits and colourtables.
uint8_t status
Current status of the Stop,.
Axis axis
Station axis, used only for the slope check callback.
std::vector< const SpriteGroup * > loaded
List of loaded groups (can be SpriteIDs or Callback results)
uint16_t local_id
id defined by the grf file for this entity
TileIndexDiff TileOffsByDiagDir(DiagDirection dir)
Convert a DiagDirection to a TileIndexDiff.
uint8_t GetAnimationFrame(Tile t)
Get the current animation frame.
@ SRT_CARGO_TAKEN
Trigger station when cargo is completely taken.
@ GES_CURRENT_MONTH
Set when cargo was delivered for final delivery this month.
static const uint CALLBACK_FAILED
Different values for Callback result evaluations.
Stores station stats for a single cargo.
CompanyID _current_company
Company currently doing an action.
uint8_t GetReverseRailTypeTranslation(RailType railtype, const GRFFile *grffile)
Perform a reverse railtype lookup to get the GRF internal ID.
bool IsCustomStationSpecIndex(Tile t)
Is there a custom rail station spec on this tile?
Slope
Enumeration for the slope-type.
Axis
Allow incrementing of DiagDirDiff variables.
@ TRANSPORT_RAIL
Transport by train.
RailTrackOffset
Offsets for sprites within an overlay/underlay set.
@ CBID_STATION_ANIM_START_STOP
Called for periodically starting or stopping the animation.
StationID GetStationIndex(Tile t)
Get StationID from a tile.
TileIndex tile
The base tile of the area.
bool HasStationReservation(Tile t)
Get the reservation state of the rail station.
static Tindex Allocate(uint32_t global_id)
Allocate a class with a given global class ID.
bool HasStationRail(Tile t)
Has this station tile a rail? In other words, is this station tile a rail station or rail waypoint?
uint8_t last_age
Age in years (up to 255) of the last vehicle that tried to load this cargo.
StationAnimationTrigger
Animation triggers for station.
void MarkTileDirtyByTile(TileIndex tile, int bridge_level_offset, int tile_height_override)
Mark a tile given by its index dirty for repaint.
static constexpr CargoID SG_PURCHASE
Used in purchase lists before an item exists.
struct BaseStation * st
Instance of the station.
@ MP_STATION
A tile of a station.
@ GES_ACCEPTANCE
Set when the station accepts the cargo currently for final deliveries.
static Station * GetByTile(TileIndex tile)
Get the station belonging to a specific tile.
uint8_t CargoID
Cargo slots to indicate a cargo type within a game.
@ CBID_STATION_ANIMATION_SPEED
Called to indicate how long the current animation frame should last.
Direction
Defines the 8 directions on the map.
Struct containing information relating to NewGRF classes for stations and airports.
uint8_t waiting_triggers
Waiting triggers (NewGRF) for this 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.
static void AnimateTile(const StationSpec *spec, BaseStation *obj, TileIndex tile, bool random_animation, int extra_data=0)
Animate a single tile.
uint16_t random_bits
Random bits assigned to this station.
uint16_t w
The width of the area.
void TriggerStationRandomisation(Station *st, TileIndex trigger_tile, StationRandomTrigger trigger, CargoID cargo_type)
Trigger station randomisation.
Helper class for a unified approach to NewGRF animation.
virtual const SpriteGroup * Resolve([[maybe_unused]] ResolverObject &object) const
Base sprite group resolver.
const DrawTileSeqStruct * seq
Array of child sprites. Terminated with a terminator entry.
GRFFilePropsBase< NUM_CARGO+3 > grf_prop
Properties related the the grf file.
SpriteID GetCustomStationFoundationRelocation(const StationSpec *statspec, BaseStation *st, TileIndex tile, uint layout, uint edge_info)
Resolve the sprites for custom station foundations.
void Insert(Tspec *spec)
Insert a spec into the class, and update its index.
const DrawTileSeqStruct * GetLayout(PalSpriteID *ground) const
Returns the result spritelayout after preprocessing.
static constexpr CargoID SG_DEFAULT_NA
Used only by stations and roads when no more-specific cargo matches.
@ ATP_TTDP_LARGE
Same as AT_LARGE.
bool IsValidCargoID(CargoID t)
Test whether cargo type is not INVALID_CARGO.
void SetStationTileRandomBits(Tile t, uint8_t random_bits)
Set the random bits for a station tile.
RoadStop * bus_stops
All the road stops.
constexpr T SB(T &x, const uint8_t s, const uint8_t n, const U d)
Set n bits in x starting at bit s to d.
PaletteID pal
The palette (use PAL_NONE) if not needed)
static Date date
Current date in days (day counter).
uint32_t GetVariable(uint8_t variable, [[maybe_unused]] uint32_t parameter, bool &available) const override
Get a variable value.
@ CBID_RANDOM_TRIGGER
Set when calling a randomizing trigger (almost undocumented).
static TileIndex FindRailStationEnd(TileIndex tile, TileIndexDiff delta, bool check_type, bool check_axis)
Find the end of a railway station, from the tile, in the direction of delta.
static debug_inline bool IsTileType(Tile tile, TileType type)
Checks if a tile is a given tiletype.
Helper class for animation control.
ResolverObject & ro
Surrounding resolver object.
uint32_t GetNewGRFVariable(const struct ResolverObject &object, uint8_t variable, uint8_t parameter, bool &available) const override
Helper function to get a NewGRF variable that isn't implemented by the base class.
constexpr T Clamp(const T a, const T min, const T max)
Clamp a value between an interval.
const struct GRFFile * grffile
grf file that introduced this entity
static debug_inline uint TileX(TileIndex tile)
Get the X component of a tile.
static struct @18 _svc
Station variable cache This caches 'expensive' station variable lookups which iterate over several ti...
const AirportSpec * GetSpec() const
Get the AirportSpec that from the airport type of this airport.
static NewGRFClass * Get(Tindex class_index)
Get a particular class.
@ HVOT_WAYPOINT
Station is a waypoint (NewGRF only!)
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.
CargoID GetCargoTranslation(uint8_t cargo, const GRFFile *grffile, bool usebit)
Translate a GRF-local cargo slot/bitnum into a CargoID.
bool DrawStationTile(int x, int y, RailType railtype, Axis axis, StationClassID sclass, uint station)
Draw representation of a station tile for GUI purposes.
void StationUpdateCachedTriggers(BaseStation *st)
Update the cached animation trigger bitmask for a station.
std::array< uint8_t, NUM_CARGO > cargo_map
Inverse cargo translation table (CargoID -> local ID)
bool HasVehicleEverTriedLoading() const
Reports whether a vehicle has ever tried to load the cargo at this station.
CargoTypes cargo_triggers
Bitmask of cargo types which cause trigger re-randomizing.
TileIndex tile
Tile of the station.
StationID GetFirstStation() const
Returns first station of the first cargo packet in this list.
constexpr T ToggleBit(T &x, const uint8_t y)
Toggles a bit in a variable.
std::array< const struct SpriteGroup *, Tcnt > spritegroup
pointers to the different sprites of the entity
uint8_t last_speed
Maximum speed (up to 255) of the last vehicle that tried to load this cargo.
uint32_t GetRandomBits() const override
Get a few random bits.
@ GES_LAST_MONTH
Set when cargo was delivered for final delivery last month.
SpriteID GetCustomRailSprite(const RailTypeInfo *rti, TileIndex tile, RailTypeSpriteGroup rtsg, TileContext context, uint *num_results)
Get the sprite to draw for the given tile.
std::vector< SpecMapping< StationSpec > > speclist
List of rail station specs of this station.
GrfSpecFeature GetFeature() const override
Get the feature number being resolved for.
DiagDirection GetTunnelBridgeDirection(Tile t)
Get the direction pointing to the other end.
TimerGameCalendar::Date build_date
Date of construction.
uint GetCustomStationSpecIndex(Tile t)
Get the custom station spec for this tile.
constexpr debug_inline bool HasBit(const T x, const uint8_t y)
Checks if a bit in a value is set.