OpenTTD Source 20250205-master-gfd85ab1e2c
|
NewGRF handling of road types. More...
#include "stdafx.h"
#include "core/container_func.hpp"
#include "debug.h"
#include "newgrf_roadtype.h"
#include "timer/timer_game_calendar.h"
#include "depot_base.h"
#include "town.h"
#include "tunnelbridge_map.h"
#include "safeguards.h"
Go to the source code of this file.
Functions | |
SpriteID | GetCustomRoadSprite (const RoadTypeInfo *rti, TileIndex tile, RoadTypeSpriteGroup rtsg, TileContext context, uint *num_results) |
Get the sprite to draw for the given tile. | |
RoadType | GetRoadTypeTranslation (RoadTramType rtt, uint8_t tracktype, const GRFFile *grffile) |
Translate an index to the GRF-local road/tramtype-translation table into a RoadType. | |
uint8_t | GetReverseRoadTypeTranslation (RoadType roadtype, const GRFFile *grffile) |
Perform a reverse roadtype lookup to get the GRF internal ID. | |
void | ConvertRoadTypes () |
Test if any saved road type labels are different to the currently loaded road types. | |
void | SetCurrentRoadTypeLabelList () |
Populate road type label list with current values. | |
void | ClearRoadTypeLabelList () |
Variables | |
std::vector< LabelObject< RoadTypeLabel > > | _roadtype_list |
NewGRF handling of road types.
Definition in file newgrf_roadtype.cpp.
void ClearRoadTypeLabelList | ( | ) |
Definition at line 231 of file newgrf_roadtype.cpp.
void ConvertRoadTypes | ( | ) |
Test if any saved road type labels are different to the currently loaded road types.
Road types stored in the map will be converted if necessary.
Definition at line 178 of file newgrf_roadtype.cpp.
References GetRoadTypeByLabel(), GetTileType(), GetTunnelBridgeTransportType(), INVALID_ROADTYPE, IsRoadWaypoint(), IsStationRoadStop(), Map::Iterate(), MP_ROAD, MP_STATION, MP_TUNNELBRIDGE, ROADTYPE_ROAD, ROADTYPE_TRAM, SetRoadTypeRoad(), SetRoadTypeTram(), and TRANSPORT_ROAD.
Referenced by AfterLoadLabelMaps().
SpriteID GetCustomRoadSprite | ( | const RoadTypeInfo * | rti, |
TileIndex | tile, | ||
RoadTypeSpriteGroup | rtsg, | ||
TileContext | context, | ||
uint * | num_results | ||
) |
Get the sprite to draw for the given tile.
rti | The road type data (spec). | |
tile | The tile to get the sprite for. | |
rtsg | The type of sprite to draw. | |
content | Where are we drawing the tile? | |
[out] | num_results | If not nullptr, return the number of sprites in the spriteset. |
Definition at line 102 of file newgrf_roadtype.cpp.
References RoadTypeInfo::group, and SpriteGroup::Resolve().
Referenced by DrawBridgeRoadBits(), DrawRoadBits(), DrawRoadDepotSprite(), DrawRoadOverlays(), DrawRoadStopTile(), DrawRoadTypeCatenary(), DrawTile_Road(), DrawTile_TunnelBridge(), and GetBridgeRoadCatenary().
Perform a reverse roadtype lookup to get the GRF internal ID.
roadtype | The global (OpenTTD) roadtype. |
grffile | The GRF to do the lookup for. |
Definition at line 154 of file newgrf_roadtype.cpp.
References find_index(), GetRoadTypeInfo(), RoadTypeInfo::label, GRFFile::roadtype_list, and GRFFile::tramtype_list.
Referenced by RoadStopScopeResolver::GetVariable().
Translate an index to the GRF-local road/tramtype-translation table into a RoadType.
rtt | Whether to index the road- or tramtype-table. |
tracktype | Index into GRF-local translation table. |
grffile | Originating GRF file. |
Definition at line 124 of file newgrf_roadtype.cpp.
References GetRoadTypeByLabel(), INVALID_ROADTYPE, GRFFile::roadtype_list, and GRFFile::tramtype_list.
void SetCurrentRoadTypeLabelList | ( | ) |
Populate road type label list with current values.
Definition at line 223 of file newgrf_roadtype.cpp.
References GetRoadTypeInfo(), RoadTypeInfo::label, ROADTYPE_BEGIN, and ROADTYPE_END.
Referenced by AfterLoadLabelMaps(), and GenerateWorld().
std::vector<LabelObject<RoadTypeLabel> > _roadtype_list |
Definition at line 172 of file newgrf_roadtype.cpp.