OpenTTD Source
1.11.0-beta2
|
Go to the documentation of this file.
32 case 0x43:
return _date;
33 case 0x44:
return HZB_TOWN_EDGE;
45 const Town *t =
nullptr;
47 t = Depot::GetByTile(this->
tile)->town;
55 DEBUG(grf, 1,
"Unhandled road type tile variable 0x%X", variable);
71 switch (GetRoadTramType(rt)) {
72 case RTT_ROAD:
return GSF_ROADTYPES;
73 case RTT_TRAM:
return GSF_TRAMTYPES;
122 assert(rtsg < ROTSG_END);
124 if (rti->
group[rtsg] ==
nullptr)
return 0;
128 if (group ==
nullptr || group->GetNumResults() == 0)
return 0;
130 if (num_results) *num_results = group->GetNumResults();
132 return group->GetResult();
175 if (grffile ==
nullptr)
return roadtype;
178 if (list->size() == 0)
return roadtype;
184 if (index >= 0)
return index;
uint32 TileIndex
The index/ID of a Tile.
const SpriteGroup ** loaded
List of loaded groups (can be SpriteIDs or Callback results)
std::vector< RoadTypeLabel > roadtype_list
Roadtype translation table (road)
static uint GB(const T x, const uint8 s, const uint8 n)
Fetch n bits from x, started at bit s.
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.
byte num_loaded
Number of loaded groups.
RoadTypeScopeResolver(ResolverObject &ro, const RoadTypeInfo *rti, TileIndex tile, TileContext context)
Constructor of the roadtype scope resolvers.
RoadTypeResolverObject(const RoadTypeInfo *rti, TileIndex tile, TileContext context, RoadTypeSpriteGroup rtsg, uint32 param1=0, uint32 param2=0)
Resolver object for road types.
@ INVALID_ROADTYPE
flag for invalid roadtype
static bool IsRoadDepotTile(TileIndex t)
Return whether a tile is a road depot tile.
TileContext context
Are we resolving sprites for the upper halftile, or on a bridge?
Interface for SpriteGroup-s to access the gamestate.
static const uint TILE_SIZE
Tile size in world coordinates.
uint8 GetReverseRoadTypeTranslation(RoadType roadtype, const GRFFile *grffile)
Perform a reverse roadtype lookup to get the GRF internal ID.
static uint TileY(TileIndex tile)
Get the Y component of a tile.
@ GSF_INVALID
An invalid spec feature.
Interface to query and set values specific to a single VarSpriteGroupScope (action 2 scope).
static uint TileX(TileIndex tile)
Get the X component of a tile.
static uint CountBits(T value)
Counts the number of set bits in a variable.
HouseZonesBits GetTownRadiusGroup(const Town *t, TileIndex tile)
Returns the bit corresponding to the town zone of the specified tile.
uint32 SpriteID
The number of a sprite, without mapping bits and colourtables.
const SpriteGroup ** loading
List of loading groups (can be SpriteIDs or Callback results)
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.
const SpriteGroup * ResolveReal(const RealSpriteGroup *group) const override
Get the real sprites of the grf.
std::vector< RoadTypeLabel > tramtype_list
Roadtype translation table (tram)
Date _date
Current date in days (day counter)
#define DEBUG(name, level,...)
Output a line of debugging information.
@ 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.
int find_index(std::vector< T > const &vec, T const &item)
Helper function to get the index of an item Consider using std::set, std::unordered_set or std::flat_...
const SpriteGroup * group[ROTSG_END]
Sprite groups for resolving sprites.
static bool IsCrossingBarred(TileIndex t)
Check if the level crossing is barred.
TileContext
Context for tile accesses.
uint32 GetDebugID() const override
Get an identifier for the item being resolved.
RoadType
The different roadtypes we support.
GrfSpecFeature GetFeature() const override
Get the feature number being resolved for.
virtual const SpriteGroup * Resolve(ResolverObject &object) const
Base sprite group resolver.
Resolver object for road types.
RoadTypeLabel label
Unique 32 bit road type identifier.
RoadType GetRoadTypeTranslation(RoadTramType rtt, uint8 tracktype, const GRFFile *grffile)
Translate an index to the GRF-local road/tramtype-translation table into a RoadType.
static const RoadTypeInfo * GetRoadTypeInfo(RoadType roadtype)
Returns a pointer to the Roadtype information for a given roadtype.
static bool IsLevelCrossingTile(TileIndex t)
Return whether a tile is a level crossing tile.
Date build_date
Date of construction.
TileIndex tile
Tracktile. For track on a bridge this is the southern bridgehead.
byte num_loading
Number of loading groups.
RoadTypeScopeResolver roadtype_scope
Resolver for the roadtype scope.
static const TileIndex INVALID_TILE
The very nice invalid tile marker.
uint32 GetVariable(byte variable, uint32 parameter, bool *available) const
Get a variable value.
uint32 GetRandomBits() const
Get a few random bits.
uint32 GetTerrainType(TileIndex tile, TileContext context)
Function used by houses (and soon industries) to get information on type of "terrain" the tile it is ...
Dynamic data of a loaded NewGRF.