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

OpenTTD Source 14.0-beta3

Data Structures | Functions | Variables
waypoint_sl.cpp File Reference
`#include "../stdafx.h"`
`#include "../waypoint_base.h"`
`#include "../debug.h"`
`#include "../newgrf_station.h"`
`#include "../vehicle_base.h"`
`#include "../town.h"`
`#include "../newgrf.h"`
`#include "../timer/timer_game_calendar.h"`
`#include "table/strings.h"`
`#include "saveload_internal.h"`
`#include "../safeguards.h"`

Go to the source code of this file.

## Data Structures
struct | OldWaypoint
| Helper structure to convert from the old waypoint system. More...
struct | CHKPChunkHandler

## Functions
static void | UpdateWaypointOrder (Order *o)
| Update the waypoint orders to get the new waypoint ID. More...
void | MoveWaypointsToBaseStations ()
| Perform all steps to upgrade from the old waypoints to the new version that uses station. More...
void | ResetOldWaypoints ()
const ChunkHandlerTable | _waypoint_chunk_handlers (waypoint_chunk_handlers)

## Variables
static std::vector< OldWaypoint > | _old_waypoints
| Temporary array with old waypoints.
static const SaveLoad | _old_waypoint_desc []
static const CHKPChunkHandler | CHKP
static const ChunkHandlerRef | waypoint_chunk_handlers []

## Detailed Description

Code handling saving and loading of waypoints

Definition in file waypoint_sl.cpp.

## Function Documentation

## ◆ MoveWaypointsToBaseStations()

void MoveWaypointsToBaseStations | ( |  | ) |

Perform all steps to upgrade from the old waypoints to the new version that uses station.

This includes some old saveload mechanics.

Definition at line 67 of file waypoint_sl.cpp.

References _old_waypoints, AllocateSpecToStation(), BaseStation::build_date, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_station_pool >::CanAllocateItem(), Debug, BaseStation::delete_ctr, FACIL_TRAIN, BaseStation::facilities, GB(), NewGRFClass< Tspec, Tid, Tmax >::Get(), GetRailTileType(), GetRailType(), NewGRFClass< Tspec, Tid, Tmax >::GetSpecCount(), GetTileOwner(), StationSpec::grf_prop, GRFFilePropsBase< Tcnt >::grffile, HasBit(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, IsSavegameVersionBefore(), IsTileType(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_orderlist_pool >::Iterate(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_vehicle_pool >::Iterate(), GRFFilePropsBase< Tcnt >::local_id, Tile::m2(), Tile::m3(), Tile::m4(), Tile::m5(), MakeRailWaypoint(), MP_RAILWAY, BaseStation::name, Order::next, BaseStation::owner, BaseStation::rect, SetCustomStationSpecIndex(), SetRailStationReservation(), Map::Size(), SlError(), SlErrorCorrupt(), SLV_100, SLV_17, STAT_CLASS_WAYP, BaseStation::string_id, BaseStation::town, Waypoint::town_cn, UpdateWaypointOrder(), and VEH_TRAIN.

## ◆ UpdateWaypointOrder()

static void UpdateWaypointOrder | ( | Order * | o | ) |
| static

Update the waypoint orders to get the new waypoint ID.

Parameters

  o | the order 'list' to check.

Definition at line 51 of file waypoint_sl.cpp.

References Order::IsType().

Referenced by MoveWaypointsToBaseStations().

## Variable Documentation

## ◆ _old_waypoint_desc

const SaveLoad _old_waypoint_desc[]
| static

Initial value:
= {
SLE_CONDVAR(OldWaypoint, xy, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_6),
SLE_CONDVAR(OldWaypoint, xy, SLE_UINT32, SLV_6, SL_MAX_VERSION),
SLE_CONDVAR(OldWaypoint, town_index, SLE_UINT16, SLV_12, SLV_122),
SLE_CONDREF(OldWaypoint, town, REF_TOWN, SLV_122, SL_MAX_VERSION),
SLE_CONDVAR(OldWaypoint, town_cn, SLE_FILE_U8 | SLE_VAR_U16, SLV_12, SLV_89),
SLE_CONDVAR(OldWaypoint, town_cn, SLE_UINT16, SLV_89, SL_MAX_VERSION),
SLE_CONDVAR(OldWaypoint, string_id, SLE_STRINGID, SL_MIN_VERSION, SLV_84),
SLE_CONDSSTR(OldWaypoint, name, SLE_STR, SLV_84, SL_MAX_VERSION),
SLE_VAR(OldWaypoint, delete_ctr, SLE_UINT8),
SLE_CONDVAR(OldWaypoint, build_date, SLE_FILE_U16 | SLE_VAR_I32, SLV_3, SLV_31),
SLE_CONDVAR(OldWaypoint, build_date, SLE_INT32, SLV_31, SL_MAX_VERSION),
SLE_CONDVAR(OldWaypoint, localidx, SLE_UINT8, SLV_3, SL_MAX_VERSION),
SLE_CONDVAR(OldWaypoint, grfid, SLE_UINT32, SLV_17, SL_MAX_VERSION),
SLE_CONDVAR(OldWaypoint, owner, SLE_UINT8, SLV_101, SL_MAX_VERSION),
}

Definition at line 170 of file waypoint_sl.cpp.

## ◆ waypoint_chunk_handlers

const ChunkHandlerRef waypoint_chunk_handlers[]
| static

Initial value:
= {
CHKP,
}

Definition at line 235 of file waypoint_sl.cpp.

REF_TOWN
@ REF_TOWN
Load/save a reference to a town.
Definition: saveload.h:583
SLE_CONDSSTR
#define SLE_CONDSSTR(base, variable, type, from, to)
Storage of a std::string in some savegame versions.
Definition: saveload.h:909
SL_MIN_VERSION
@ SL_MIN_VERSION
First savegame version.
Definition: saveload.h:31
SLE_CONDVAR
#define SLE_CONDVAR(base, variable, type, from, to)
Storage of a variable in some savegame versions.
Definition: saveload.h:844
OldWaypoint
Helper structure to convert from the old waypoint system.
Definition: waypoint_sl.cpp:26
SLV_6
@ SLV_6
6.0 1721 6.1 1768
Definition: saveload.h:46
SLV_89
@ SLV_89
89 12160
Definition: saveload.h:149
SLE_CONDREF
#define SLE_CONDREF(base, variable, type, from, to)
Storage of a reference in some savegame versions.
Definition: saveload.h:865
SLV_31
@ SLV_31
31 5999
Definition: saveload.h:80
SL_MAX_VERSION
@ SL_MAX_VERSION
Highest possible saveload version.
Definition: saveload.h:379
SLV_84
@ SLV_84
84 11822
Definition: saveload.h:143
SLE_VAR
#define SLE_VAR(base, variable, type)
Storage of a variable in every version of a savegame.
Definition: saveload.h:948
SLV_3
@ SLV_3
3.x lost
Definition: saveload.h:36
SLV_12
@ SLV_12
12.1 2046
Definition: saveload.h:55
SLV_17
@ SLV_17
17.0 3212 17.1 3218
Definition: saveload.h:62
SLV_101
@ SLV_101
101 14233
Definition: saveload.h:164
SLV_122
@ SLV_122
122 16855
Definition: saveload.h:189