# 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"`

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.
void | MoveWaypointsToBaseStations ()
| Perform all steps to upgrade from the old waypoints to the new version that uses station.
static void | Load_WAYP ()
static void | Ptrs_WAYP ()
## Variables
static SmallVector < OldWaypoint, 16 > | _old_waypoints
| Temporary array with old waypoints.
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

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 65 of file waypoint_sl.cpp.

References _m, AllocateSpecToStation(), SmallVector< T, S >::Begin(), BaseStation::build_date, CheckSavegameVersion(), Vehicle::current_order, BaseStation::delete_ctr, SmallVector< T, S >::End(), FACIL_TRAIN, BaseStation::facilities, GB(), GetCustomStationSpec(), OrderList::GetFirstOrder(), OrderList::GetFirstSharedVehicle(), GetNumCustomStations(), GetRailTileType(), GetRailType(), GetTileOwner(), StationSpec::grffile, HasBit(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem< Tpool >::index, IsTileType(), StationSpec::localidx, Tile::m2, Tile::m3, Tile::m4, MakeRailWaypoint(), MP_RAILWAY, BaseStation::name, Order::next, BaseStation::owner, BaseStation::rect, SmallVector< T, S >::Reset(), SetCustomStationSpecIndex(), SetRailStationReservation(), STAT_CLASS_WAYP, BaseStation::string_id, BaseStation::town, Waypoint::town_cn, BaseVehicle::type, UpdateWaypointOrder(), and VEH_TRAIN.

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 49 of file waypoint_sl.cpp.

References SmallVector< T, S >::Begin(), SmallVector< T, S >::End(), Order::GetDestination(), Order::IsType(), and Order::SetDestination().

Referenced by MoveWaypointsToBaseStations().

## Variable Documentation

const SaveLoad _old_waypoint_desc[]`[static]`

Initial value:

     {
      SLE_CONDVAR(OldWaypoint, xy,         SLE_FILE_U16 | SLE_VAR_U32,  0, 5),
      SLE_CONDVAR(OldWaypoint, xy,         SLE_UINT32,                  6, SL_MAX_VERSION),
      SLE_CONDVAR(OldWaypoint, town_index, SLE_UINT16,                 12, 121),
      SLE_CONDREF(OldWaypoint, town,       REF_TOWN,                  122, SL_MAX_VERSION),
      SLE_CONDVAR(OldWaypoint, town_cn,    SLE_FILE_U8 | SLE_VAR_U16,  12, 88),
      SLE_CONDVAR(OldWaypoint, town_cn,    SLE_UINT16,                 89, SL_MAX_VERSION),
      SLE_CONDVAR(OldWaypoint, string_id,  SLE_STRINGID,                0, 83),
      SLE_CONDSTR(OldWaypoint, name,       SLE_STR, 0,                 84, SL_MAX_VERSION),
          SLE_VAR(OldWaypoint, delete_ctr, SLE_UINT8),

      SLE_CONDVAR(OldWaypoint, build_date, SLE_FILE_U16 | SLE_VAR_I32,  3, 30),
      SLE_CONDVAR(OldWaypoint, build_date, SLE_INT32,                  31, SL_MAX_VERSION),
      SLE_CONDVAR(OldWaypoint, localidx,   SLE_UINT8,                   3, SL_MAX_VERSION),
      SLE_CONDVAR(OldWaypoint, grfid,      SLE_UINT32,                 17, SL_MAX_VERSION),
      SLE_CONDVAR(OldWaypoint, owner,      SLE_UINT8,                 101, SL_MAX_VERSION),

    }

Definition at line 147 of file waypoint_sl.cpp.

SmallVector<OldWaypoint, 16> _old_waypoints`[static]`

Temporary array with old waypoints.

Definition at line 43 of file waypoint_sl.cpp.

const ChunkHandler _waypoint_chunk_handlers[]

Initial value:

     {
      { 'CHKP', NULL, Load_WAYP, Ptrs_WAYP, CH_ARRAY | CH_LAST},
    }