OpenTTD Source
20240917-master-g9ab0a47812
|
Go to the documentation of this file.
34 case 0x44:
return HZB_TOWN_EDGE;
46 const Town *t =
nullptr;
48 t = Depot::GetByTile(this->
tile)->town;
56 Debug(grf, 1,
"Unhandled road type tile variable 0x{:X}", variable);
65 switch (GetRoadTramType(rt)) {
66 case RTT_ROAD:
return GSF_ROADTYPES;
67 case RTT_TRAM:
return GSF_TRAMTYPES;
103 assert(rtsg < ROTSG_END);
105 if (rti->
group[rtsg] ==
nullptr)
return 0;
109 if (group ==
nullptr || group->GetNumResults() == 0)
return 0;
111 if (num_results) *num_results = group->GetNumResults();
113 return group->GetResult();
156 if (grffile ==
nullptr)
return roadtype;
159 if (list->empty())
return roadtype;
165 if (index >= 0)
return index;
static debug_inline uint TileY(TileIndex tile)
Get the Y component of a tile.
std::vector< RoadTypeLabel > roadtype_list
Roadtype translation table (road)
RoadType GetRoadTypeByLabel(RoadTypeLabel label, bool allow_alternate_labels)
Get the road type for a given label.
Town * ClosestTownFromTile(TileIndex tile, uint threshold)
Return the town closest (in distance or ownership) to a given tile, within a given threshold.
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.
TileContext context
Are we resolving sprites for the upper halftile, or on a bridge?
uint32_t GetVariable(uint8_t variable, [[maybe_unused]] uint32_t parameter, bool &available) const override
Get a variable value.
Interface for SpriteGroup-s to access the gamestate.
constexpr TileIndex INVALID_TILE
The very nice invalid tile marker.
static const uint TILE_SIZE
Tile size in world coordinates.
bool IsLevelCrossingTile(Tile t)
Return whether a tile is a level crossing tile.
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 ...
@ GSF_INVALID
An invalid spec feature.
uint8_t GetReverseRoadTypeTranslation(RoadType roadtype, const GRFFile *grffile)
Perform a reverse roadtype lookup to get the GRF internal ID.
#define Debug(category, level, format_string,...)
Ouptut a line of debugging information.
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_...
HouseZonesBits GetTownRadiusGroup(const Town *t, TileIndex tile)
Returns the bit corresponding to the town zone of the specified tile.
SpriteID GetCustomRoadSprite(const RoadTypeInfo *rti, TileIndex tile, RoadTypeSpriteGroup rtsg, TileContext context, uint *num_results)
Get the sprite to draw for the given tile.
RoadTypeSpriteGroup
Sprite groups for a roadtype.
std::vector< RoadTypeLabel > tramtype_list
Roadtype translation table (tram)
RoadType GetRoadTypeTranslation(RoadTramType rtt, uint8_t tracktype, const GRFFile *grffile)
Translate an index to the GRF-local road/tramtype-translation table into a RoadType.
@ 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.
const SpriteGroup * group[ROTSG_END]
Sprite groups for resolving sprites.
RoadType
The different roadtypes we support.
TileContext
Context for tile accesses.
bool IsCrossingBarred(Tile t)
Check if the level crossing is barred.
TimerGameCalendar::Date build_date
Date of construction.
@ INVALID_ROADTYPE
flag for invalid roadtype
uint32_t SpriteID
The number of a sprite, without mapping bits and colourtables.
constexpr uint CountBits(T value)
Counts the number of set bits in a variable.
const RoadTypeInfo * GetRoadTypeInfo(RoadType roadtype)
Returns a pointer to the Roadtype information for a given roadtype.
GrfSpecFeature GetFeature() const override
Get the feature number being resolved for.
Resolver object for road types.
uint32_t GetDebugID() const override
Get an identifier for the item being resolved.
RoadTypeLabel label
Unique 32 bit road type identifier.
virtual const SpriteGroup * Resolve([[maybe_unused]] ResolverObject &object) const
Base sprite group resolver.
TileIndex tile
Tracktile. For track on a bridge this is the southern bridgehead.
RoadTypeResolverObject(const RoadTypeInfo *rti, TileIndex tile, TileContext context, RoadTypeSpriteGroup rtsg, uint32_t param1=0, uint32_t param2=0)
Resolver object for road types.
RoadTypeScopeResolver roadtype_scope
Resolver for the roadtype scope.
static Date date
Current date in days (day counter).
static debug_inline uint TileX(TileIndex tile)
Get the X component of a tile.
uint32_t GetRandomBits() const override
Get a few random bits.
Dynamic data of a loaded NewGRF.
static debug_inline bool IsRoadDepotTile(Tile t)
Return whether a tile is a road depot tile.