OpenTTD
waypoint_sl.cpp File Reference

Code handling saving and loading of waypoints. More...

#include "../stdafx.h"
#include "../waypoint_base.h"
#include "../newgrf_station.h"
#include "../vehicle_base.h"
#include "../town.h"
#include "../newgrf.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...
 

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...
 
static void Load_WAYP ()
 
static void Ptrs_WAYP ()
 

Variables

static SmallVector< OldWaypoint, 16 > _old_waypoints
 Temporary array with old waypoints. More...
 
static const SaveLoad _old_waypoint_desc []
 
const ChunkHandler _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 _m, SmallVector< T, S >::Begin(), SmallVector< T, S >::End(), IsSavegameVersionBefore(), Tile::m2, and SLV_17.

◆ UpdateWaypointOrder()

static void UpdateWaypointOrder ( Order o)
static

Update the waypoint orders to get the new waypoint ID.

Parameters
othe order 'list' to check.

Definition at line 51 of file waypoint_sl.cpp.

References Order::IsType().

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, town_index, SLE_UINT16, SLV_12, SLV_122),
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_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),
}
12.1 2046
Definition: saveload.h:56
#define SLE_CONDSTR(base, variable, type, length, from, to)
Storage of a string in some savegame versions.
Definition: saveload.h:556
#define SLE_CONDREF(base, variable, type, from, to)
Storage of a reference in some savegame versions.
Definition: saveload.h:534
101 14233
Definition: saveload.h:165
Load/save a reference to a town.
Definition: saveload.h:364
17.0 3212 17.1 3218
Definition: saveload.h:63
Helper structure to convert from the old waypoint system.
Definition: waypoint_sl.cpp:26
122 16855
Definition: saveload.h:190
#define SLE_CONDVAR(base, variable, type, from, to)
Storage of a variable in some savegame versions.
Definition: saveload.h:524
Highest possible saveload version.
Definition: saveload.h:295
First savegame version.
Definition: saveload.h:32
84 11822
Definition: saveload.h:144
6.0 1721 6.1 1768
Definition: saveload.h:47
3.x lost
Definition: saveload.h:37
89 12160
Definition: saveload.h:150
Owner owner
The owner of the content shown in this window. Company colour is acquired from this variable...
Definition: window_gui.h:326
#define SLE_VAR(base, variable, type)
Storage of a variable in every version of a savegame.
Definition: saveload.h:584
#define SLE_STR(base, variable, type, length)
Storage of a string in every savegame version.
Definition: saveload.h:610
31 5999
Definition: saveload.h:81

Definition at line 152 of file waypoint_sl.cpp.

◆ _old_waypoints

SmallVector<OldWaypoint, 16> _old_waypoints
static

Temporary array with old waypoints.

Definition at line 45 of file waypoint_sl.cpp.

◆ _waypoint_chunk_handlers

const ChunkHandler _waypoint_chunk_handlers[]
Initial value:
= {
{ 'CHKP', NULL, Load_WAYP, Ptrs_WAYP, NULL, CH_ARRAY | CH_LAST},
}
Last chunk in this array.
Definition: saveload.h:381