Go to the documentation of this file.
10 #include "../stdafx.h"
11 #include "../station_map.h"
12 #include "../tunnelbridge_map.h"
17 #include "../safeguards.h"
19 static std::vector<RailTypeLabel> _railtype_list;
28 for (uint i = 0; i < _railtype_list.size(); i++) {
31 if (rti->
label != _railtype_list[i])
return true;
33 if (_railtype_list[i] != 0)
return true;
41 void AfterLoadLabelMaps()
44 std::vector<RailType> railtype_conversion_map;
46 for (uint i = 0; i < _railtype_list.size(); i++) {
50 railtype_conversion_map.push_back(r);
88 _railtype_list.clear();
96 static const SaveLoad _label_object_desc[] = {
101 static void Save_RAIL()
113 static void Load_RAIL()
121 _railtype_list.push_back((RailTypeLabel)lo.label);
125 extern const ChunkHandler _labelmaps_chunk_handlers[] = {
126 {
'RAIL', Save_RAIL, Load_RAIL,
nullptr,
nullptr, CH_ARRAY |
CH_LAST},
uint32 TileIndex
The index/ID of a Tile.
@ TRANSPORT_RAIL
Transport by train.
This struct contains all the info that is needed to draw and construct tracks.
@ CH_LAST
Last chunk in this array.
Handlers and description of chunk.
@ MP_ROAD
A tile with road (or tram tracks)
static bool IsLevelCrossing(TileIndex t)
Return whether a tile is a level crossing.
static const RailtypeInfo * GetRailTypeInfo(RailType railtype)
Returns a pointer to the Railtype information for a given railtype.
static uint MapSize()
Get the size of the map.
RailType
Enumeration for all possible railtypes.
static bool HasStationRail(TileIndex t)
Has this station tile a rail? In other words, is this station tile a rail station or rail waypoint?
Container for a label for SaveLoad system.
#define SLE_END()
End marker of a struct/class save or load.
@ MP_TUNNELBRIDGE
Tunnel entry/exit and bridge heads.
void SlObject(void *object, const SaveLoad *sld)
Main SaveLoad function.
static bool NeedRailTypeConversion()
Test if any saved rail type labels are different to the currently loaded rail types,...
#define SLE_VAR(base, variable, type)
Storage of a variable in every version of a savegame.
@ RAILTYPE_END
Used for iterations.
static RailType GetRailType(TileIndex t)
Gets the rail type of the given tile.
@ MP_STATION
A tile of a station.
RailTypeLabel label
Unique 32 bit rail type identifier.
RailType GetRailTypeByLabel(RailTypeLabel label, bool allow_alternate_labels)
Get the rail type for a given label.
static TileType GetTileType(TileIndex tile)
Get the tiletype of a given tile.
static TransportType GetTunnelBridgeTransportType(TileIndex t)
Tunnel: Get the transport type of the tunnel (road or rail) Bridge: Get the transport type of the bri...
static void SetRailType(TileIndex t, RailType r)
Sets the rail type of the given tile.
int SlIterateArray()
Iterate through the elements of an array and read the whole thing.
@ INVALID_RAILTYPE
Flag for invalid railtype.
@ RAILTYPE_BEGIN
Used for iterations.