34 case 0x44:
return HZB_TOWN_EDGE;
46 const Town *t =
nullptr;
48 t = Depot::GetByTile(this->
tile)->town;
56 Debug(grf, 1,
"Unhandled rail type tile variable 0x{:X}", variable);
98 assert(rtsg < RTSG_END);
100 if (rti->
group[rtsg] ==
nullptr)
return 0;
104 if (group ==
nullptr || group->GetNumResults() == 0)
return 0;
106 if (num_results) *num_results = group->GetNumResults();
108 return group->GetResult();
125 uint32_t param1 = gui ? 0x10 : 0x00;
126 uint32_t param2 = (type << 16) | (var << 8) | state;
130 if (group ==
nullptr || group->GetNumResults() == 0)
return 0;
132 return group->GetResult();
147 return static_cast<RailType>(railtype);
166 if (grffile ==
nullptr || grffile->
railtype_list.empty())
return railtype;
172 if (idx >= 0)
return idx;
constexpr uint CountBits(T value)
Counts the number of set bits in a variable.
debug_inline static constexpr uint GB(const T x, const uint8_t s, const uint8_t n)
Fetch n bits from x, started at bit s.
This struct contains all the info that is needed to draw and construct tracks.
RailTypeLabel label
Unique 32 bit rail type identifier.
const SpriteGroup * group[RTSG_END]
Sprite groups for resolving sprites.
static Date date
Current date in days (day counter).
Some simple functions to help with accessing containers.
int find_index(Container const &container, typename Container::const_reference item)
Helper function to get the index of an item Consider using std::set, std::unordered_set or std::flat_...
Functions related to debugging.
#define Debug(category, level, format_string,...)
Ouptut a line of debugging information.
Base for all depots (except hangars)
uint32_t SpriteID
The number of a sprite, without mapping bits and colourtables.
static debug_inline uint TileY(TileIndex tile)
Get the Y component of a tile.
static debug_inline uint TileX(TileIndex tile)
Get the X component of a tile.
@ CBID_NO_CALLBACK
Set when using the callback resolve system, but not to resolve a callback.
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 ...
TileContext
Context for tile accesses.
@ TCX_NORMAL
Nothing special.
SpriteID GetCustomSignalSprite(const RailTypeInfo *rti, TileIndex tile, SignalType type, SignalVariant var, SignalState state, bool gui)
Get the sprite to draw for a given signal.
uint8_t GetReverseRailTypeTranslation(RailType railtype, const GRFFile *grffile)
Perform a reverse railtype lookup to get the GRF internal ID.
SpriteID GetCustomRailSprite(const RailTypeInfo *rti, TileIndex tile, RailTypeSpriteGroup rtsg, TileContext context, uint *num_results)
Get the sprite to draw for the given tile.
RailType GetRailTypeTranslation(uint8_t railtype, const GRFFile *grffile)
Translate an index to the GRF-local railtype-translation table into a RailType.
NewGRF handling of rail types.
RailType GetRailTypeByLabel(RailTypeLabel label, bool allow_alternate_labels)
Get the rail type for a given label.
RailTypeSpriteGroup
Sprite groups for a railtype.
@ RTSG_SIGNALS
Signal images.
const RailTypeInfo * GetRailTypeInfo(RailType railtype)
Returns a pointer to the Railtype information for a given railtype.
static debug_inline bool IsRailDepotTile(Tile t)
Is this tile rail tile and a rail depot?
RailType
Enumeration for all possible railtypes.
@ RAILTYPE_END
Used for iterations.
@ INVALID_RAILTYPE
Flag for invalid railtype.
bool IsLevelCrossingTile(Tile t)
Return whether a tile is a level crossing tile.
bool IsCrossingBarred(Tile t)
Check if the level crossing is barred.
A number of safeguards to prevent using unsafe methods.
SignalType
Type of signal, i.e.
SignalState
These are states in which a signal can be.
SignalVariant
Variant of the signal, i.e.
Definition of base types and functions in a cross-platform compatible way.
TimerGameCalendar::Date build_date
Date of construction.
Dynamic data of a loaded NewGRF.
std::vector< RailTypeLabel > railtype_list
Railtype translation table.
Resolver object for rail types.
GrfSpecFeature GetFeature() const override
Get the feature number being resolved for.
RailTypeResolverObject(const RailTypeInfo *rti, TileIndex tile, TileContext context, RailTypeSpriteGroup rtsg, uint32_t param1=0, uint32_t param2=0)
Resolver object for rail types.
uint32_t GetDebugID() const override
Get an identifier for the item being resolved.
RailTypeScopeResolver railtype_scope
Resolver for the railtype scope.
uint32_t GetVariable(uint8_t variable, uint32_t parameter, bool &available) const override
Get a variable value.
TileContext context
Are we resolving sprites for the upper halftile, or on a bridge?
uint32_t GetRandomBits() const override
Get a few random bits.
TileIndex tile
Tracktile. For track on a bridge this is the southern bridgehead.
Interface for SpriteGroup-s to access the gamestate.
const SpriteGroup * root_spritegroup
Root SpriteGroup to use for resolving.
virtual const SpriteGroup * Resolve(ResolverObject &object) const
Base sprite group resolver.
static const uint TILE_SIZE
Tile size in world coordinates.
constexpr TileIndex INVALID_TILE
The very nice invalid tile marker.
Definition of the game-calendar-timer.
HouseZonesBits GetTownRadiusGroup(const Town *t, TileIndex tile)
Returns the bit corresponding to the town zone of the specified tile.
Town * ClosestTownFromTile(TileIndex tile, uint threshold)
Return the town closest (in distance or ownership) to a given tile, within a given threshold.