OpenTTD Source: src/saveload/labelmaps_sl.cpp File Reference

OpenTTD Source 15.0-beta1

Data Structures | Functions | Variables
labelmaps_sl.cpp File Reference

Code handling saving and loading of rail type label mappings. More...

`#include "../stdafx.h"`
`#include "saveload.h"`
`#include "compat/labelmaps_sl_compat.h"`
`#include "saveload_internal.h"`
`#include "../rail.h"`
`#include "../road.h"`
`#include "../station_map.h"`
`#include "../tunnelbridge_map.h"`
`#include "../safeguards.h"`

Go to the source code of this file.

## Data Structures
struct | LabelObject< T >
| Container for a label for rail or road type conversion. More...
struct | RAILChunkHandler
struct | ROTTChunkHandler

## Functions
static void | ConvertRailTypes ()
| Test if any saved rail type labels are different to the currently loaded rail types.
static void | ConvertRoadTypes ()
| Test if any saved road type labels are different to the currently loaded road types.
static void | SetCurrentLabelLists ()
| Populate label lists with current values.
void | AfterLoadLabelMaps ()
| Perform rail type and road type conversion if necessary.
void | ResetLabelMaps ()
const ChunkHandlerTable | _labelmaps_chunk_handlers (labelmaps_chunk_handlers)

## Variables
static std::vector< LabelObject< RailTypeLabel > > | _railtype_list
static std::vector< LabelObject< RoadTypeLabel > > | _roadtype_list
static const RAILChunkHandler | RAIL
static const ROTTChunkHandler | ROTT
static const ChunkHandlerRef | labelmaps_chunk_handlers []

## Detailed Description

Code handling saving and loading of rail type label mappings.

Definition in file labelmaps_sl.cpp.

## Function Documentation

## ◆ AfterLoadLabelMaps()

void AfterLoadLabelMaps | ( |  | ) |

Perform rail type and road type conversion if necessary.

Definition at line 148 of file labelmaps_sl.cpp.

References ConvertRailTypes(), ConvertRoadTypes(), and SetCurrentLabelLists().

Referenced by AfterLoadGame(), and ReloadNewGRFData().

## ◆ ConvertRailTypes()

static void ConvertRailTypes | ( |  | ) |
| static

Test if any saved rail type labels are different to the currently loaded rail types.

Rail types stored in the map will be converted if necessary.

Definition at line 37 of file labelmaps_sl.cpp.

References GetRailType(), GetRailTypeByLabel(), GetTileType(), GetTunnelBridgeTransportType(), HasStationRail(), INVALID_RAILTYPE, IsLevelCrossing(), Map::Iterate(), MP_RAILWAY, MP_ROAD, MP_STATION, MP_TUNNELBRIDGE, RAILTYPE_RAIL, SetRailType(), and TRANSPORT_RAIL.

Referenced by AfterLoadLabelMaps().

## ◆ ConvertRoadTypes()

static void ConvertRoadTypes | ( |  | ) |
| static

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 89 of file labelmaps_sl.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().

## ◆ ResetLabelMaps()

void ResetLabelMaps | ( |  | ) |

Definition at line 156 of file labelmaps_sl.cpp.

## ◆ SetCurrentLabelLists()

static void SetCurrentLabelLists | ( |  | ) |
| static

Populate label lists with current values.

Definition at line 134 of file labelmaps_sl.cpp.

References GetRailTypeInfo(), GetRoadTypeInfo(), RailTypeInfo::label, RoadTypeInfo::label, RAILTYPE_BEGIN, RAILTYPE_END, ROADTYPE_BEGIN, and ROADTYPE_END.

Referenced by AfterLoadLabelMaps().

## Variable Documentation

## ◆ _railtype_list

std::vector<LabelObject<RailTypeLabel> > _railtype_list
| static

Definition at line 30 of file labelmaps_sl.cpp.

## ◆ _roadtype_list

std::vector<LabelObject<RoadTypeLabel> > _roadtype_list
| static

Definition at line 31 of file labelmaps_sl.cpp.

## ◆ labelmaps_chunk_handlers

const ChunkHandlerRef labelmaps_chunk_handlers[]
| static

Initial value:
= {
RAIL,
ROTT,
}

Definition at line 238 of file labelmaps_sl.cpp.

## ◆ RAIL

const RAILChunkHandler RAIL
| static

Definition at line 235 of file labelmaps_sl.cpp.

## ◆ ROTT

const ROTTChunkHandler ROTT
| static

Definition at line 236 of file labelmaps_sl.cpp.