# station_sl.cpp File Reference

Code handling saving and loading of economy data. More...

`#include "../stdafx.h"`
`#include "../station_base.h"`
`#include "../waypoint_base.h"`
`#include "../roadstop_base.h"`
`#include "../vehicle_base.h"`
`#include "../newgrf_station.h"`
`#include "saveload.h"`
`#include "table/strings.h"`

Go to the source code of this file.

## Functions

static void | UpdateWaypointOrder (Order *o)
| Update the buoy orders to be waypoint orders.
void | MoveBuoysToWaypoints ()
| Perform all steps to upgrade from the old station buoys to the new version that uses waypoints.
void | AfterLoadStations ()
void | AfterLoadRoadStops ()
| (Re)building of road stop caches after loading a savegame.
const SaveLoad * | GetGoodsDesc ()
| Wrapper function to get the GoodsEntry's internal structure while some of the variables itself are private.
static void | Load_STNS ()
static void | Ptrs_STNS ()
const SaveLoad * | GetBaseStationDescription ()
| Get the base station description to be used for SL_ST_INCLUDE.
static void | RealSave_STNN (BaseStation *bst)
static void | Save_STNN ()
static void | Load_STNN ()
static void | Ptrs_STNN ()
static void | Save_ROADSTOP ()
static void | Load_ROADSTOP ()
static void | Ptrs_ROADSTOP ()

## Variables

static const SaveLoad | _roadstop_desc []
static const SaveLoad | _old_station_desc []
static uint16 | _waiting_acceptance
static uint16 | _cargo_source
static uint32 | _cargo_source_xy
static uint16 | _cargo_days
static Money | _cargo_feeder_share
static const SaveLoad | _station_speclist_desc []
static const SaveLoad | _base_station_desc []
static const SaveLoad | _station_desc []
static const SaveLoad | _waypoint_desc []
const ChunkHandler | _station_chunk_handlers []

## Detailed Description

Code handling saving and loading of economy data.

Definition in file station_sl.cpp.

## Function Documentation

const SaveLoad* GetBaseStationDescription | ( |  | ) |

Get the base station description to be used for SL_ST_INCLUDE.

Returns:
  the base station description.

Definition at line 367 of file station_sl.cpp.

const SaveLoad* GetGoodsDesc | ( |  | ) |

Wrapper function to get the GoodsEntry's internal structure while some of the variables itself are private.

The stations, via GoodsEntry, have a CargoList.

Returns:
  the saveload description for GoodsEntry.

Definition at line 225 of file station_sl.cpp.

void MoveBuoysToWaypoints | ( |  | ) |

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

This includes some old saveload mechanics.

Definition at line 40 of file station_sl.cpp.

References BaseStation::build_date, Vehicle::current_order, BaseStation::delete_ctr, FACIL_DOCK, BaseStation::facilities, OrderList::GetFirstOrder(), OrderList::GetFirstSharedVehicle(), GetStationIndex(), HVOT_WAYPOINT, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem< Tpool >::index, IsBuoyTile(), IsInsideBS(), BaseStation::name, Order::next, BaseStation::owner, OWNER_NONE, BaseStation::rect, BaseStation::string_id, BaseStation::town, Waypoint::town_cn, BaseVehicle::type, UpdateWaypointOrder(), VEH_SHIP, and BaseStation::xy.

static void UpdateWaypointOrder | ( | Order * | o | ) | `[static]`

Update the buoy orders to be waypoint orders.

Parameters:

  | o | the order 'list' to check.

Definition at line 26 of file station_sl.cpp.

References SpecializedStation< Station, false >::Get(), Order::GetDestination(), HVOT_WAYPOINT, Order::IsType(), and Order::MakeGoToWaypoint().

Referenced by MoveBuoysToWaypoints().

## Variable Documentation

const SaveLoad _base_station_desc[]`[static]`

Initial value:

     {
            SLE_VAR(BaseStation, xy,                     SLE_UINT32),
            SLE_REF(BaseStation, town,                   REF_TOWN),
            SLE_VAR(BaseStation, string_id,              SLE_STRINGID),
            SLE_STR(BaseStation, name,                   SLE_STR, 0),
            SLE_VAR(BaseStation, delete_ctr,             SLE_UINT8),
            SLE_VAR(BaseStation, owner,                  SLE_UINT8),
            SLE_VAR(BaseStation, facilities,             SLE_UINT8),
            SLE_VAR(BaseStation, build_date,             SLE_INT32),

            SLE_VAR(BaseStation, random_bits,            SLE_UINT16),
            SLE_VAR(BaseStation, waiting_triggers,       SLE_UINT8),
            SLE_VAR(BaseStation, num_specs,              SLE_UINT8),

    }

Definition at line 305 of file station_sl.cpp.

const SaveLoad _roadstop_desc[]`[static]`

Initial value:

     {
      SLE_VAR(RoadStop, xy,           SLE_UINT32),
      SLE_CONDNULL(1, 0, 44),
      SLE_VAR(RoadStop, status,       SLE_UINT8),

      SLE_CONDNULL(4, 0, 8),
      SLE_CONDNULL(2, 0, 44),
      SLE_CONDNULL(1, 0, 25),

      SLE_REF(RoadStop, next,         REF_ROADSTOPS),
      SLE_CONDNULL(2, 0, 44),

      SLE_CONDNULL(4, 0, 24),
      SLE_CONDNULL(1, 25, 25),

    }

Definition at line 130 of file station_sl.cpp.

const ChunkHandler _station_chunk_handlers[]

Initial value:

     {
      { 'STNS', NULL,          Load_STNS,     Ptrs_STNS,     CH_ARRAY },
      { 'STNN', Save_STNN,     Load_STNN,     Ptrs_STNN,     CH_ARRAY },
      { 'ROAD', Save_ROADSTOP, Load_ROADSTOP, Ptrs_ROADSTOP, CH_ARRAY | CH_LAST},
    }

const SaveLoad _station_desc[]`[static]`

Initial value:

     {
      SLE_WRITEBYTE(Station, facilities,                 FACIL_NONE),
      SLE_ST_INCLUDE(),

            SLE_VAR(Station, train_station.tile,         SLE_UINT32),
            SLE_VAR(Station, train_station.w,            SLE_FILE_U8 | SLE_VAR_U16),
            SLE_VAR(Station, train_station.h,            SLE_FILE_U8 | SLE_VAR_U16),

            SLE_REF(Station, bus_stops,                  REF_ROADSTOPS),
            SLE_REF(Station, truck_stops,                REF_ROADSTOPS),
            SLE_VAR(Station, dock_tile,                  SLE_UINT32),
            SLE_VAR(Station, airport_tile,               SLE_UINT32),
            SLE_VAR(Station, airport_type,               SLE_UINT8),
            SLE_VAR(Station, airport_flags,              SLE_UINT64),

            SLE_VAR(Station, indtype,                    SLE_UINT8),

            SLE_VAR(Station, time_since_load,            SLE_UINT8),
            SLE_VAR(Station, time_since_unload,          SLE_UINT8),
            SLE_VAR(Station, last_vehicle_type,          SLE_UINT8),
            SLE_VAR(Station, had_vehicle_of_type,        SLE_UINT8),
            SLE_LST(Station, loading_vehicles,           REF_VEHICLE),
        SLE_CONDVAR(Station, always_accepted,            SLE_UINT32, 127, SL_MAX_VERSION),

    }

Definition at line 323 of file station_sl.cpp.

const SaveLoad _station_speclist_desc[]`[static]`

Initial value:

     {
      SLE_CONDVAR(StationSpecList, grfid,    SLE_UINT32, 27, SL_MAX_VERSION),
      SLE_CONDVAR(StationSpecList, localidx, SLE_UINT8,  27, SL_MAX_VERSION),

    }

Definition at line 213 of file station_sl.cpp.

const SaveLoad _waypoint_desc[]`[static]`

Initial value:

     {
      SLE_WRITEBYTE(Waypoint, facilities,                FACIL_WAYPOINT),
      SLE_ST_INCLUDE(),

            SLE_VAR(Waypoint, town_cn,                   SLE_UINT16),

        SLE_CONDVAR(Waypoint, train_station.tile,        SLE_UINT32,                  124, SL_MAX_VERSION),
        SLE_CONDVAR(Waypoint, train_station.w,           SLE_FILE_U8 | SLE_VAR_U16,   124, SL_MAX_VERSION),
        SLE_CONDVAR(Waypoint, train_station.h,           SLE_FILE_U8 | SLE_VAR_U16,   124, SL_MAX_VERSION),

    }

Definition at line 350 of file station_sl.cpp.