12 #ifndef NEWGRF_ROADSTATION_H
13 #define NEWGRF_ROADSTATION_H
25 static const uint32_t ROADSTOP_CLASS_LABEL_DEFAULT =
'DFLT';
26 static const uint32_t ROADSTOP_CLASS_LABEL_WAYPOINT =
'WAYP';
62 ROADSTOP_DRAW_MODE_NONE = 0,
106 uint32_t
GetVariable(uint8_t variable, [[maybe_unused]] uint32_t parameter,
bool &available)
const override;
122 if (tsr !=
nullptr)
return tsr;
147 uint8_t callback_mask = 0;
181 void AnimateRoadStopTile(
TileIndex tile);
182 uint8_t GetRoadStopTileAnimationSpeed(
TileIndex tile);
192 void DeallocateSpecFromRoadStop(
BaseStation *st, uint8_t specindex);
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.
uint8_t CargoID
Cargo slots to indicate a cargo type within a game.
Struct containing information relating to NewGRF classes for stations and airports.
uint32_t global_id
Global ID for class, e.g. 'DFLT', 'WAYP', etc.
DECLARE_ENUM_AS_BIT_SET(GenderEthnicity) enum CompanyManagerFaceVariable
Bitgroups of the CompanyManagerFace variable.
Money GetPrice(Price index, uint cost_factor, const GRFFile *grf_file, int shift)
Determine a certain price.
Price
Enumeration of all base prices for use with Prices.
#define DECLARE_POSTFIX_INCREMENT(enum_type)
Some enums need to have allowed incrementing (i.e.
Definitions related to NewGRF animation.
StationAnimationTrigger
Animation triggers for station.
CallbackID
List of implemented NewGRF callbacks.
@ CBID_NO_CALLBACK
Set when using the callback resolve system, but not to resolve a callback.
Header file for classes to be used by e.g.
This file simplyfies and embeds a common mechanism of loading/saving and mapping of grf entities.
RoadStopDrawMode
Different draw modes to disallow rendering of some parts of the stop or road.
@ ROADSTOP_DRAW_MODE_ROAD
Bay stops: Draw the road itself.
@ ROADSTOP_DRAW_MODE_OVERLAY
Drive-through stops: Draw the road overlay, e.g. pavement.
@ ROADSTOP_DRAW_MODE_WAYP_GROUND
Waypoints: Draw the sprite layout ground tile (on top of the road)
@ RSRT_VEH_ARRIVES
Trigger roadstop when road vehicle arrives.
@ RSRT_CARGO_TAKEN
Trigger roadstop when cargo is completely taken.
@ RSRT_NEW_CARGO
Trigger roadstop on arrival of new cargo.
@ RSRT_VEH_DEPARTS
Trigger roadstop when road vehicle leaves.
@ RSRT_VEH_LOADS
Trigger roadstop when road vehicle loads.
bool IsWaypointClass(const RoadStopClass &cls)
Test if a RoadStopClass is the waypoint class.
@ RSV_BAY_NW
Bay road stop, facing Northwest.
@ RSV_BAY_SW
Bay road stop, facing Southwest.
@ RSV_BAY_SE
Bay road stop, facing Southeast.
@ RSV_BAY_NE
Bay road stop, facing Northeast.
@ RSV_DRIVE_THROUGH_X
Drive through road stop, X axis.
@ RSV_DRIVE_THROUGH_Y
Drive through road stop, Y axis.
@ ROADSTOP_CLASS_BEGIN
The lowest valid value.
@ ROADSTOP_CLASS_DFLT
Default road stop class.
@ ROADSTOP_CLASS_MAX
Maximum number of classes.
@ ROADSTOP_CLASS_WAYP
Waypoint class.
void RoadStopUpdateCachedTriggers(BaseStation *st)
Update the cached animation trigger bitmask for a station.
RoadStopAvailabilityType
Various different options for availability, restricting the roadstop to be only for busses or for tru...
@ ROADSTOPTYPE_FREIGHT
This RoadStop is for freight (truck) stops.
@ ROADSTOPTYPE_ALL
This RoadStop is for both types of station road stops.
@ ROADSTOPTYPE_PASSENGER
This RoadStop is for passenger (bus) stops.
bool GetIfClassHasNewStopsByType(const RoadStopClass *roadstopclass, RoadStopType rs, RoadType roadtype)
Checks if the given RoadStopClass has any specs assigned to it, compatible with the given RoadStopTyp...
void DrawRoadStopTile(int x, int y, RoadType roadtype, const RoadStopSpec *spec, StationType type, int view)
Draw representation of a road stop tile for GUI purposes.
@ RSF_NO_AUTO_ROAD_CONNECTION
No auto road connection.
@ RSF_NO_CATENARY
Do not show catenary.
@ RSF_CB141_RANDOM_BITS
Callback 141 needs random bits.
@ RSF_DRAW_MODE_REGISTER
Read draw mode from register 0x100.
@ RSF_DRIVE_THROUGH_ONLY
Stop is drive-through only.
@ RSF_BUILD_MENU_ROAD_ONLY
Only show in the road build menu (not tram).
@ RSF_BUILD_MENU_TRAM_ONLY
Only show in the tram build menu (not road).
bool GetIfNewStopsByType(RoadStopType rs, RoadType roadtype)
Checks if there's any new stations by a specific RoadStopType.
static const int NUM_ROADSTOPS_PER_GRF
The maximum amount of roadstops a single GRF is allowed to add.
bool GetIfStopIsForType(const RoadStopSpec *roadstopspec, RoadStopType rs, RoadType roadtype)
Checks if the given RoadStopSpec is compatible with the given RoadStopType.
void TriggerRoadStopRandomisation(Station *st, TileIndex tile, RoadStopRandomTrigger trigger, CargoID cargo_type=INVALID_CARGO)
Trigger road stop randomisation.
@ VSG_SCOPE_SELF
Resolved object itself.
@ VSG_SCOPE_PARENT
Related object of the resolved one.
Functions to handle the town part of NewGRF towns.
RoadType
The different roadtypes we support.
RoadStopType
Types of RoadStops.
StationType
Station types.
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
Information about animation.
Base class for all station-ish types.
const struct GRFFile * grffile
grf file that introduced this entity
uint16_t index
Index within class of this spec, invalid until inserted into class.
Interface for SpriteGroup-s to access the gamestate.
CallbackID callback
Callback being resolved.
virtual ScopeResolver * GetScope(VarSpriteGroupScope scope=VSG_SCOPE_SELF, uint8_t relative=0)
Get a resolver for the scope.
const SpriteGroup * ResolveReal(const RealSpriteGroup *group) const override
Get the real sprites of the grf.
std::optional< TownScopeResolver > town_scope
The town scope resolver (created on the first call).
ScopeResolver * GetScope(VarSpriteGroupScope scope=VSG_SCOPE_SELF, uint8_t relative=0) override
Get a resolver for the scope.
RoadStopScopeResolver roadstop_scope
The stop scope resolver.
Scope resolver for road stops.
uint8_t view
Station axis.
uint32_t GetTriggers() const override
Get the triggers.
RoadType roadtype
Road type (used when no tile)
StationType type
Station type.
const struct RoadStopSpec * roadstopspec
Station (type) specification.
CargoID cargo_type
Type of cargo of the station.
struct BaseStation * st
Instance of the station.
TileIndex tile
Tile of the station.
uint32_t GetVariable(uint8_t variable, [[maybe_unused]] uint32_t parameter, bool &available) const override
Get a variable value.
uint32_t GetRandomBits() const override
Get a few random bits.
StringID name
Name of this stop.
uint8_t bridge_height[6]
Minimum height for a bridge above, 0 for none.
uint8_t clear_cost_multiplier
Clear cost multiplier per tile.
Money GetBuildCost(Price category) const
Get the cost for building a road stop of this type.
uint8_t build_cost_multiplier
Build cost multiplier per tile.
CargoTypes cargo_triggers
Bitmask of cargo types which cause trigger re-randomizing.
uint8_t bridge_disallowed_pillars[6]
Disallowed pillar flags for a bridge above.
GRFFilePropsBase< NUM_CARGO+3 > grf_prop
Properties related the the grf file.
Money GetClearCost(Price category) const
Get the cost for clearing a road stop of this type.
Interface to query and set values specific to a single VarSpriteGroupScope (action 2 scope).
ResolverObject & ro
Surrounding resolver object.
Scope resolver for a town.