OpenTTD Source 20260721-master-g25ec12c62d
waypoint_sl.cpp File Reference

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

#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 "saveload_internal.h"
#include "table/strings.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

Typedefs

using OldWaypointID = uint16_t

Functions

static void UpdateWaypointOrder (Order &o)
 Update the waypoint orders to get the new waypoint ID.
void MoveWaypointsToBaseStations ()
 Perform all steps to upgrade from the old waypoints to the new version that uses station.
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.

Typedef Documentation

◆ OldWaypointID

using OldWaypointID = uint16_t

Definition at line 24 of file waypoint_sl.cpp.

Function Documentation

◆ MoveWaypointsToBaseStations()

◆ ResetOldWaypoints()

void ResetOldWaypoints ( )

Definition at line 164 of file waypoint_sl.cpp.

◆ UpdateWaypointOrder()

void UpdateWaypointOrder ( Order & o)
static

Update the waypoint orders to get the new waypoint ID.

Parameters
othe order 'list' to check.

Definition at line 52 of file waypoint_sl.cpp.

References _old_waypoints, Order::GetDestination(), Order::IsType(), and Order::SetDestination().

Referenced by MoveWaypointsToBaseStations().

Variable Documentation

◆ _old_waypoint_desc

const SaveLoad _old_waypoint_desc[]
static
Initial value:
= {
}
@ U32
A 32 bit unsigned int.
Definition saveload.h:658
@ I32
A 32 bit signed int.
Definition saveload.h:657
@ U16
A 16 bit unsigned int.
Definition saveload.h:656
@ U8
A 8 bit unsigned int.
Definition saveload.h:637
@ U16
A 16 bit unsigned int.
Definition saveload.h:639
@ Town
Load/save a reference to a town.
Definition saveload.h:620
#define SLE_CONDSSTR(base, variable, type, from, to)
Storage of a std::string in some savegame versions.
Definition saveload.h:938
#define SLE_CONDVAR(base, variable, type, from, to)
Storage of a variable in some savegame versions.
Definition saveload.h:884
@ BigDates
Saveload version: 31, SVN revision: 5999 Change date from 1920 - 2090 to 0 - 5 000 000.
Definition saveload.h:84
@ ReplaceCustomNameArray
Saveload version: 84, SVN revision: 11822 Replace single fixed size array of custom names,...
Definition saveload.h:147
@ MoreWaypointsPerTown
Saveload version: 89, SVN revision: 12160 Support more than 64 waypoints per town.
Definition saveload.h:153
@ LinkWaypointToTown
Saveload version: 12.1, SVN revision: 2046 Link waypoints to towns and remove some bit stuffing.
Definition saveload.h:59
@ StoreWaypointIdInMap
Saveload version: 17.0, SVN revision: 3212 Store the ID of waypoints in m2 of the map.
Definition saveload.h:66
@ NewGRFPalette
Saveload version: 101, SVN revision: 14233 Store palette used by each of the NewGRFs.
Definition saveload.h:168
@ MultipleRoadStops
Saveload version: 6.0, SVN revision: 1721 Multi tile road stops, and some map size related fixes.
Definition saveload.h:50
@ MinVersion
First savegame version.
Definition saveload.h:34
@ WaypointMoreLikeStation
Saveload version: 122, SVN revision: 16855 Make waypoint data look more like stations.
Definition saveload.h:193
@ BiggerStationVariables
Saveload version: 3.0 Increase size of airport blocks/station build date.
Definition saveload.h:40
@ MaxVersion
Highest possible saveload version.
Definition saveload.h:424
#define SLE_CONDREF(base, variable, type, from, to)
Storage of a reference in some savegame versions.
Definition saveload.h:905
#define SLE_VAR(base, variable, type)
Storage of a variable in every version of a savegame.
Definition saveload.h:997
Helper structure to convert from the old waypoint system.
static constexpr VarType U16
Store a 16 bits unsigned int.
Definition saveload.h:729
static constexpr VarType U8
Store a 8 bits unsigned int.
Definition saveload.h:727
static constexpr VarType STR
Store string.
Definition saveload.h:735
static constexpr VarType LABEL_REVERSE
Store a Label in reverse.
Definition saveload.h:738
static constexpr VarType U32
Store a 32 bits unsigned int.
Definition saveload.h:731
static constexpr VarType STRINGID
Store a StringID.
Definition saveload.h:734
static constexpr VarType I32
Store a 32 bits signed int.
Definition saveload.h:730

Definition at line 170 of file waypoint_sl.cpp.

◆ _old_waypoints

std::vector<OldWaypoint> _old_waypoints
static

Temporary array with old waypoints.

Definition at line 46 of file waypoint_sl.cpp.

Referenced by CHKPChunkHandler::FixPointers(), CHKPChunkHandler::Load(), MoveWaypointsToBaseStations(), and UpdateWaypointOrder().

◆ CHKP

const CHKPChunkHandler CHKP
static

Definition at line 234 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.