Go to the documentation of this file.
30 template <
typename Tspec,
typename T
id, T
id Tmax>
34 classes[0].global_id =
'DFLT';
35 classes[0].name = STR_STATION_CLASS_DFLT;
36 classes[0].Insert(
nullptr);
38 classes[1].global_id =
'WAYP';
39 classes[1].name = STR_STATION_CLASS_WAYP;
40 classes[1].Insert(
nullptr);
43 template <
typename Tspec,
typename T
id, T
id Tmax>
63 default: NOT_REACHED();
110 Swap(platforms, length);
119 SB(retval, 0, 4, y & 0xF);
120 SB(retval, 4, 4, x & 0xF);
122 SB(retval, 0, 4, std::min(15, y));
123 SB(retval, 4, 4, std::min(15, length - y - 1));
124 SB(retval, 8, 4, std::min(15, x));
125 SB(retval, 12, 4, std::min(15, platforms - x - 1));
127 SB(retval, 16, 4, std::min(15, length));
128 SB(retval, 20, 4, std::min(15, platforms));
129 SB(retval, 24, 4, tile);
166 static uint32 GetPlatformInfoHelper(
TileIndex tile,
bool check_type,
bool check_axis,
bool centred)
168 int tx =
TileX(tile);
169 int ty =
TileY(tile);
182 static uint32 GetRailContinuationInfo(
TileIndex tile)
201 for (i = 0; i <
lengthof(x_dir); i++, dir++, diagdir++) {
265 if (t ==
nullptr)
return nullptr;
273 if (this->
st ==
nullptr) {
280 case 0x49:
return 0x2110000;
290 bool swap = (this->axis ==
AXIS_Y &&
HasBit(tileh, CORNER_W) !=
HasBit(tileh, CORNER_E));
306 if (!
HasBit(
_svc.valid, 0)) {
_svc.v40 = GetPlatformInfoHelper(this->tile,
false,
false,
false);
SetBit(
_svc.valid, 0); }
310 if (!
HasBit(
_svc.valid, 1)) {
_svc.v41 = GetPlatformInfoHelper(this->tile,
true,
false,
false);
SetBit(
_svc.valid, 1); }
321 if (!
HasBit(
_svc.valid, 3)) {
_svc.v46 = GetPlatformInfoHelper(this->tile,
false,
false,
true);
SetBit(
_svc.valid, 3); }
325 if (!
HasBit(
_svc.valid, 4)) {
_svc.v47 = GetPlatformInfoHelper(this->tile,
true,
false,
true);
SetBit(
_svc.valid, 4); }
329 if (!
HasBit(
_svc.valid, 5)) {
_svc.v49 = GetPlatformInfoHelper(this->tile,
false,
true,
false);
SetBit(
_svc.valid, 5); }
362 uint32 res =
GB(
GetStationGfx(nearby_tile), 1, 2) << 12 | !!perpendicular << 11 | !!same_station << 10;
382 case 0x82:
return 50;
392 uint32 Station::GetNewGRFVariable(
const ResolverObject &
object,
byte variable,
byte parameter,
bool *available)
const
399 for (cargo_type = 0; cargo_type <
NUM_CARGO; cargo_type++) {
405 case 0x8A:
return this->had_vehicle_of_type;
414 if ((variable >= 0x60 && variable <= 0x65) || variable == 0x69) {
419 case 0x62:
return 0xFFFFFFFF;
420 case 0x64:
return 0xFF00;
443 if (variable >= 0x8C && variable <= 0xEC) {
445 switch (
GB(variable - 0x8C, 0, 3)) {
457 DEBUG(grf, 1,
"Unhandled station variable 0x%X", variable);
476 if (variable >= 0x60 && variable <= 0x65) {
481 if (variable >= 0x8C && variable <= 0xEC) {
482 switch (
GB(variable - 0x8C, 0, 3)) {
483 case 3:
return INITIAL_STATION_RATING;
484 case 4:
return INVALID_STATION;
489 DEBUG(grf, 1,
"Unhandled station variable 0x%X", variable);
523 cargo = std::min(0xfffu, cargo);
533 return group->
loaded[set];
560 CallbackID callback, uint32 callback_param1, uint32 callback_param2)
561 :
ResolverObject(statspec->grf_prop.grffile, callback, callback_param1, callback_param2),
562 station_scope(*this, statspec, st, tile), town_scope(nullptr)
576 FOR_ALL_CARGOSPECS(cs) {
594 StationResolverObject::~StationResolverObject()
611 if (group ==
nullptr || group->type != SGT_RESULT)
return 0;
612 return group->GetResult() - 0x42D;
630 if (group ==
nullptr || group->type != SGT_RESULT)
return 0;
640 return object.ResolveCallback();
661 object.station_scope.axis = axis;
663 uint16 cb_res =
object.ResolveCallback();
685 if (statspec ==
nullptr || st ==
nullptr)
return 0;
698 if (st->
speclist[i].spec == statspec)
return i;
737 if (specindex == 0)
return;
748 st->
speclist[specindex].spec =
nullptr;
789 if (statspec ==
nullptr)
return false;
797 uint32 relocation = 0;
798 uint32 ground_relocation = 0;
803 sprites = GetStationTileLayout(STATION_RAIL, tile + axis);
805 layout = &statspec->
renderdata[(tile < statspec->
tiles) ? tile + axis : (uint)axis];
812 if (layout !=
nullptr) {
823 sprites = &tmp_rail_layout;
840 DrawSprite(ground + overlay_offset, PAL_NONE, x, y);
871 const StationSpec *statspec = GetStationSpec(tile);
884 const StationSpec *statspec = GetStationSpec(tile);
887 return statspec !=
nullptr ?
HasBit(statspec->
pylons, gfx) : gfx < 4;
898 const StationSpec *statspec = GetStationSpec(tile);
905 return GetStationCallback(callback, param1, param2, statspec, st, tile);
920 if (ss ==
nullptr)
return;
928 static const TriggerArea tas[] = {
929 TA_TILE, TA_WHOLE, TA_WHOLE, TA_PLATFORM, TA_PLATFORM, TA_PLATFORM, TA_WHOLE
939 uint16 random_bits = Random();
969 static const TriggerArea tas[] = {
970 TA_WHOLE, TA_WHOLE, TA_PLATFORM, TA_PLATFORM, TA_PLATFORM, TA_PLATFORM
981 uint32 whole_reseed = 0;
984 CargoTypes empty_mask = 0;
996 uint32 used_triggers = 0;
1002 if (ss ==
nullptr)
continue;
1015 if (group ==
nullptr)
continue;
1017 used_triggers |=
object.used_triggers;
1019 uint32 reseed =
object.GetReseedSum();
1021 whole_reseed |= reseed;
1026 random_bits &= ~reseed;
1027 random_bits |= Random() & reseed;
1038 if ((whole_reseed & 0xFFFF) != 0) {
1055 for (uint i = 0; i < st->
num_specs; i++) {
1057 if (ss !=
nullptr) {
static void DrawRailTileSeqInGUI(int x, int y, const DrawTileSprites *dts, int32 total_offset, uint32 newgrf_offset, PaletteID default_palette)
Draw tile sprite sequence in GUI with railroad specifics.
int AllocateSpecToStation(const StationSpec *statspec, BaseStation *st, bool exec)
Allocate a StationSpec to a Station.
StationFacility facilities
The facilities that this station has.
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...
uint32 TileIndex
The index/ID of a Tile.
#define TILE_ADD(x, y)
Adds to tiles together.
CargoID cargo_type
Type of cargo of the station.
const SpriteGroup ** loaded
List of loaded groups (can be SpriteIDs or Callback results)
GoodsEntry goods[NUM_CARGO]
Goods at this station.
@ TRACK_BIT_NONE
No track.
byte flags
Bitmask of flags, bit 0: use different sprite set; bit 1: divide cargo about by station size.
static TileIndexDiff TileOffsByDiagDir(DiagDirection dir)
Convert a DiagDirection to a TileIndexDiff.
Direction
Defines the 8 directions on the map.
static uint GB(const T x, const uint8 s, const uint8 n)
Fetch n bits from x, started at bit s.
uint DaysInTransit() const
Returns average number of days in transit for a cargo entity.
uint32 PrepareLayout(uint32 orig_offset, uint32 newgrf_ground_offset, uint32 newgrf_offset, uint constr_stage, bool separate_ground) const
Prepares a sprite layout before resolving action-1-2-3 chains.
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.
byte waiting_triggers
Waiting triggers (NewGRF) for this station.
SpriteID GetCustomStationRelocation(const StationSpec *statspec, BaseStation *st, TileIndex tile, uint32 var10)
Resolve sprites for drawing a station tile.
StationRandomTrigger
Randomisation triggers for stations.
@ TRANSPORT_RAIL
Transport by train.
uint32 GetTriggers() const override
Get the triggers.
Town * town
The town this station is associated with.
static BaseStation * GetByTile(TileIndex tile)
Get the base station belonging to a specific tile.
byte num_loaded
Number of loaded groups.
@ SSF_DIV_BY_STATION_SIZE
Divide cargo amount by station size.
static void ChangeAnimationFrame(CallbackID cb, const StationSpec *spec, BaseStation *obj, TileIndex tile, uint32 random_bits, uint32 trigger, int extra_data=0)
Check a callback to determine what the next animation step is and execute that step.
static bool IsCustomStationSpecIndex(TileIndex t)
Is there a custom rail station spec on this tile?
uint32 GetNewGRFVariable(const struct ResolverObject &object, byte variable, byte parameter, bool *available) const override
Helper function to get a NewGRF variable that isn't implemented by the base class.
uint8 localidx
Station ID within GRF of station.
#define INSTANTIATE_NEWGRF_CLASS_METHODS(name, Tspec, Tid, Tmax)
Force instantiation of the methods so we don't get linker errors.
SpriteID sprite
The 'real' sprite.
Interface for SpriteGroup-s to access the gamestate.
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
void ProcessRegisters(uint8 resolved_var10, uint32 resolved_sprite, bool separate_ground) const
Evaluates the register modifiers and integrates them into the preprocessed sprite layout.
This struct contains all the info that is needed to draw and construct tracks.
const GRFFile * grffile
GRFFile the resolved SpriteGroup belongs to.
static bool IsCompatibleTrainStationTile(TileIndex test_tile, TileIndex station_tile)
Check if a tile is a valid continuation to a railstation tile.
uint8 valid
Bits indicating what variable is valid (for each bit, 0 is invalid, 1 is valid).
const struct StationSpec * statspec
Station (type) specification.
uint16 GetAnimStationCallback(CallbackID callback, uint32 param1, uint32 param2, const StationSpec *statspec, BaseStation *st, TileIndex tile, int extra_data)
Wrapper for animation control, see GetStationCallback.
static struct @32 _svc
Station variable cache This caches 'expensive' station variable lookups which iterate over several ti...
static uint32 GetRegister(uint i)
Gets the value of a so-called newgrf "register".
@ CBM_STATION_ANIMATION_NEXT_FRAME
Use a custom next frame callback.
Specification of a cargo type.
static void AnimateTile(const StationSpec *spec, BaseStation *obj, TileIndex tile, bool random_animation, int extra_data=0)
Animate a single tile.
static uint TileY(TileIndex tile)
Get the Y component of a tile.
CallbackID
List of implemented NewGRF callbacks.
@ SLOPE_EW
east and west corner are raised
byte fallback_railtype
Original railtype number to use when drawing non-newgrf railtypes, or when drawing stations.
StationScopeResolver station_scope
The station scope resolver.
TownScopeResolver * GetTown()
Get the town scope associated with a station, if it exists.
void DeallocateSpecFromStation(BaseStation *st, byte specindex)
Deallocate a StationSpec from a Station.
Owner owner
The owner of this station.
static const uint NUM_STATIONSSPECS_PER_STATION
Maximum number of parts per station.
byte status
Status of this cargo, see GoodsEntryStatus.
uint TotalCount() const
Returns total count of cargo at the station, including cargo which is already reserved for loading.
uint8 num_specs
Number of specs in the speclist.
static uint TileX(TileIndex tile)
Get the X component of a tile.
NewGRFSpriteLayout * renderdata
Array of tile layouts.
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.
TrackStatus GetTileTrackStatus(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side)
Returns information about trackdirs and signal states.
uint32 SpriteID
The number of a sprite, without mapping bits and colourtables.
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.
uint tiles
Number of tile layouts.
uint32 grfid
GRF ID of this custom station.
StationCargoList cargo
The cargo packets of cargo waiting in this station.
PalSpriteID ground
Palette and sprite for the ground.
static const RailtypeInfo * GetRailTypeInfo(RailType railtype)
Returns a pointer to the Railtype information for a given railtype.
bool IsUIAvailable(uint index) const
Check whether the spec will be available to the user at some point in time.
StationID Source() const
Returns source of the first cargo packet in this list.
const SpriteGroup ** loading
List of loading groups (can be SpriteIDs or Callback results)
uint32 GetPlatformInfo(Axis axis, byte 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.
CargoID Index() const
Determines index of this cargospec.
static byte GetAnimationFrame(TileIndex t)
Get the current animation frame.
StationCallbackMask
Callback masks for stations.
void TriggerStationRandomisation(Station *st, TileIndex tile, StationRandomTrigger trigger, CargoID cargo_type)
Trigger station randomisation.
RailType
Enumeration for all possible railtypes.
@ STAT_CLASS_WAYP
Waypoint class.
Common return value for all commands.
static uint GetCustomStationSpecIndex(TileIndex t)
Get the custom station spec for this tile.
@ CBID_STATION_LAND_SLOPE_CHECK
Callback done for each tile of a station to check the slope.
Date _date
Current date in days (day counter)
static bool HasStationRail(TileIndex t)
Has this station tile a rail? In other words, is this station tile a rail station or rail waypoint?
#define TILE_AREA_LOOP(var, ta)
A loop which iterates over the tiles of a TileArea.
@ 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.
@ CBM_STATION_ANIMATION_SPEED
Customize the animation speed of the station.
uint16 random_bits
Random bits assigned to this station.
TownScopeResolver * town_scope
The town scope resolver (created on the first call).
int32 TileIndexDiff
An offset value between to tiles.
bool HasRating() const
Does this cargo have a rating at this station?
byte pylons
Bitmask of base tiles (0 - 7) which should contain elrail pylons.
#define DEBUG(name, level,...)
Output a line of debugging information.
static TrackBits TrackStatusToTrackBits(TrackStatus ts)
Returns the present-track-information of a TrackStatus.
@ HVOT_WAYPOINT
Station is a waypoint (NewGRF only!)
@ CBID_NO_CALLBACK
Set when using the callback resolve system, but not to resolve a callback.
byte last_speed
Maximum speed (up to 255) of the last vehicle that tried to load this cargo.
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 T SB(T &x, const uint8 s, const uint8 n, const U d)
Set n bits in x starting at bit s to d.
static bool IsExpected(const BaseStation *st)
Helper for checking whether the given station is of this type.
uint16 w
The width of the area.
Airport airport
Tile area the airport covers.
Represents the covered area of e.g.
Struct containing information relating to NewGRF classes for stations and airports.
bool TileBelongsToRailStation(TileIndex tile) const override
Check whether a specific tile belongs to this station.
CommandCost GetErrorMessageFromLocationCallbackResult(uint16 cb_res, const GRFFile *grffile, StringID default_error)
Get the error message from a shape/location/slope check callback result.
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.
static TileIndexDiff TileOffsByDir(Direction dir)
Convert a Direction to a TileIndexDiff.
NewGRF supplied spritelayout.
static bool HasStationTileRail(TileIndex t)
Has this station tile a rail? In other words, is this station tile a rail station or rail waypoint?
static TrackBits DiagdirReachesTracks(DiagDirection diagdir)
Returns all tracks that can be reached when entering a tile from a given (diagonal) direction.
bool NeedsPreprocessing() const
Tests whether this spritelayout needs preprocessing by PrepareLayout() and ProcessRegisters(),...
uint64 flags
stores which blocks on the airport are taken. was 16 bit earlier on, then 32
static void SetStationTileRandomBits(TileIndex t, byte random_bits)
Set the random bits for a station tile.
Slope GetTileSlope(TileIndex tile, int *h)
Return the slope of a given tile inside the map.
bool CanStationTileHaveWires(TileIndex tile)
Check if a rail station tile shall have wires when electrified.
@ SPRITE_MODIFIER_CUSTOM_SPRITE
Set when a sprite originates from an Action 1.
static bool HasStationReservation(TileIndex t)
Get the reservation state of the rail station.
Ground palette sprite of a tile, together with its sprite layout.
@ STAT_CLASS_MAX
Maximum number of classes.
void DrawSprite(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub, ZoomLevel zoom)
Draw a sprite, not in a viewport.
@ MP_TUNNELBRIDGE
Tunnel entry/exit and bridge heads.
@ RTSG_GROUND
Main group of ground images.
Scope resolver for a town.
byte rating
Station rating for this cargo.
uint32 GetNearbyTileInformation(TileIndex tile, bool grf_version8)
Common part of station var 0x67, house var 0x62, indtile var 0x60, industry var 0x62.
Slope
Enumeration for the slope-type.
DiagDirection
Enumeration for diagonal directions.
static Station * From(BaseStation *st)
Converts a BaseStation to SpecializedStation with type checking.
@ CBID_STATION_ANIM_NEXT_FRAME
Called to determine station tile next animation frame.
static bool IsRailStationTile(TileIndex t)
Is this tile a station tile and a rail station?
uint32 GetDebugID() const override
Get an identifier for the item being resolved.
RoadStop * truck_stops
All the truck stops.
const SpriteGroup * ResolveReal(const RealSpriteGroup *group) const override
Get the real sprites of the grf.
static void InsertDefaults()
Initialise the defaults.
static DiagDirection AxisToDiagDir(Axis a)
Converts an Axis to a DiagDirection.
static bool IsTileType(TileIndex tile, TileType type)
Checks if a tile is a given tiletype.
Axis axis
Station axis, used only for the slope check callback.
static DiagDirection GetTunnelBridgeDirection(TileIndex t)
Get the direction pointing to the other end.
static PaletteID GroundSpritePaletteTransform(SpriteID image, PaletteID pal, PaletteID default_pal)
Applies PALETTE_MODIFIER_COLOUR to a palette entry of a ground sprite.
uint16 h
The height of the area.
virtual const SpriteGroup * Resolve(ResolverObject &object) const
Base sprite group resolver.
bool IsStationTileBlocked(TileIndex tile)
Check whether a rail station tile is NOT traversable.
@ 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.
SpriteID GetCustomRailSprite(const RailtypeInfo *rti, TileIndex tile, RailTypeSpriteGroup rtsg, TileContext context, uint *num_results)
Get the sprite to draw for the given tile.
Stores station stats for a single cargo.
CompanyID _current_company
Company currently doing an action.
static T Clamp(const T a, const T min, const T max)
Clamp a value between an interval.
const struct SpriteGroup * spritegroup[Tcnt]
pointer to the different sprites of the entity
byte last_age
Age in years (up to 255) of the last vehicle that tried to load this cargo.
CommandCost PerformStationTileSlopeCheck(TileIndex north_tile, TileIndex cur_tile, const StationSpec *statspec, Axis axis, byte plat_len, byte numtracks)
Check the slope of a tile of a new station.
static StationGfx GetStationGfx(TileIndex t)
Get the station graphics of this tile.
static Axis GetRailStationAxis(TileIndex t)
Get the rail direction of a rail station.
RailTrackOffset
Offsets for sprites within an overlay/underlay set.
@ CBID_STATION_ANIM_START_STOP
Called for periodically starting or stopping the animation.
TileIndex tile
The base tile of the area.
uint32 PaletteID
The number of the palette.
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 TileIndexDiff TileDiffXY(int x, int y)
Calculates an offset for the given coordinate(-offset).
static RailType GetRailType(TileIndex t)
Gets the rail type of the given tile.
struct BaseStation * st
Instance of the station.
@ MP_STATION
A tile of a station.
@ NUM_CARGO
Maximal number of cargo types in a game.
@ 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.
static StationID GetStationIndex(TileIndex t)
Get StationID from a tile.
byte time_since_pickup
Number of rating-intervals (up to 255) since the last vehicle tried to load this cargo.
CargoID GetCargoTranslation(uint8 cargo, const GRFFile *grffile, bool usebit)
Translate a GRF-local cargo slot/bitnum into a CargoID.
uint8 cargo_map[NUM_CARGO]
Inverse cargo translation table (CargoID -> local ID)
uint32 GetRandomBits() const override
Get a few random bits.
@ CBID_STATION_ANIMATION_SPEED
Called to indicate how long the current animation frame should last.
Base class for all station-ish types.
static byte GetStationTileRandomBits(TileIndex t)
Get the random bits of a station tile.
bool CanStationTileHavePylons(TileIndex tile)
Check if a rail station tile shall have pylons when electrified.
uint16 triggers
The triggers that trigger animation.
byte status
Current status of the Stop,.
static T * ReallocT(T *t_ptr, size_t num_elements)
Simplified reallocation function that allocates the specified number of elements of the given type.
uint8 GetReverseRailTypeTranslation(RailType railtype, const GRFFile *grffile)
Perform a reverse railtype lookup to get the GRF internal ID.
uint32 GetCompanyInfo(CompanyID owner, const Livery *l)
Returns company information like in vehicle var 43 or station var 43.
uint16 cargo_threshold
Cargo threshold for choosing between little and lots of cargo.
StationSpecList * speclist
List of station specs of this station.
TrackBits
Bitfield corresponding to Track.
Helper class for a unified approach to NewGRF animation.
const DrawTileSeqStruct * seq
Array of child sprites. Terminated with a terminator entry.
static T ToggleBit(T &x, const uint8 y)
Toggles a bit in a variable.
static T SetBit(T &x, const uint8 y)
Set a bit in a variable.
#define lengthof(x)
Return the length of an fixed size array.
GRFFilePropsBase< NUM_CARGO+3 > grf_prop
Properties related the the grf file.
static NewGRFClass * Get(Tid cls_id)
Get a particular class.
byte num_loading
Number of loading groups.
byte CargoID
Cargo slots to indicate a cargo type within a game.
SpriteID GetCustomStationFoundationRelocation(const StationSpec *statspec, BaseStation *st, TileIndex tile, uint layout, uint edge_info)
Resolve the sprites for custom station foundations.
TileIndex GetNearbyTile(byte parameter, TileIndex tile, bool signed_offsets, Axis axis)
Get the tile at the given offset.
static const TileIndex INVALID_TILE
The very nice invalid tile marker.
Axis
Allow incrementing of DiagDirDiff variables.
const DrawTileSeqStruct * GetLayout(PalSpriteID *ground) const
Returns the result spritelayout after preprocessing.
@ ATP_TTDP_LARGE
Same as AT_LARGE.
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.
RoadStop * bus_stops
All the road stops.
uint16 local_id
id defined by the grf file for this entity
PaletteID pal
The palette (use PAL_NONE) if not needed)
@ CBID_RANDOM_TRIGGER
Set when calling a randomizing trigger (almost undocumented).
byte callback_mask
Bitmask of station callbacks that have to be called.
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.
Helper class for animation control.
ResolverObject & ro
Surrounding resolver object.
const struct GRFFile * grffile
grf file that introduced this entity
@ CBM_STATION_SPRITE_LAYOUT
Use callback to select a sprite layout to use.
static void Swap(T &a, T &b)
Type safe swap operation.
@ INVALID_AXIS
Flag for an invalid Axis.
const AirportSpec * GetSpec() const
Get the AirportSpec that from the airport type of this airport.
static void free(const void *ptr)
Version of the standard free that accepts const pointers.
@ CT_INVALID
Invalid cargo type.
@ DIAGDIR_NE
Northeast, upper right on your monitor.
uint32 GetVariable(byte variable, uint32 parameter, bool *available) const override
Get a variable value.
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.
Date build_date
Date of construction.
StationResolverObject(const StationSpec *statspec, BaseStation *st, TileIndex tile, CallbackID callback=CBID_NO_CALLBACK, uint32 callback_param1=0, uint32 callback_param2=0)
Resolver for stations.
@ CBID_STATION_SPRITE_LAYOUT
Choose a sprite layout to draw, instead of the standard 0-7 range.
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.
#define FOR_EACH_SET_BIT(bitpos_var, bitset_value)
Do an operation for each set set bit in a value.
uint GetRailtypeSpriteOffset() const
Offset between the current railtype and normal rail.
byte wires
Bitmask of base tiles (0 - 7) which should contain elrail wires.
uint32 GetTerrainType(TileIndex tile, TileContext context)
Function used by houses (and soon industries) to get information on type of "terrain" the tile it is ...
byte blocked
Bitmask of base tiles (0 - 7) which are blocked to trains.
#define DAYS_TILL_ORIGINAL_BASE_YEAR
The offset in days from the '_date == 0' till 'ConvertYMDToDate(ORIGINAL_BASE_YEAR,...
@ GES_LAST_MONTH
Set when cargo was delivered for final delivery last month.
GrfSpecFeature GetFeature() const override
Get the feature number being resolved for.