OpenTTD Source 20260917-master-gec444f7315
station_sl.cpp File Reference

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

#include "../stdafx.h"
#include "saveload.h"
#include "compat/station_sl_compat.h"
#include "../station_base.h"
#include "../waypoint_base.h"
#include "../roadstop_base.h"
#include "../vehicle_base.h"
#include "../newgrf_station.h"
#include "../newgrf_roadstop.h"
#include "../town.h"
#include "../timer/timer_game_calendar.h"
#include "table/strings.h"
#include "../safeguards.h"

Go to the source code of this file.

Data Structures

struct  FlowSaveLoad
class  SlStationSpecList< T >
class  SlStationWaitingTriggers
class  SlStationCargo
class  SlStationFlow
class  SlStationGoods
struct  STNSChunkHandler
class  SlRoadStopTileData
class  SlStationBase
 SaveLoad handler for the BaseStation, which all other stations / waypoints make use of. More...
class  SlStationNormal
 SaveLoad handler for a normal station (read: not a waypoint). More...
class  SlStationWaypoint
struct  STNNChunkHandler
struct  ROADChunkHandler

Typedefs

typedef std::pair< const StationID, std::list< CargoPacket * > > StationCargoPair

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.
static void SwapPackets (GoodsEntry *ge)
 Swap the temporary packets with the packets without specific destination in the given goods entry.
const ChunkHandlerTable _station_chunk_handlers (station_chunk_handlers)

Variables

static const SaveLoad _roadstop_desc []
static uint16_t _waiting_acceptance
static uint32_t _old_num_flows
static uint16_t _cargo_source
static uint32_t _cargo_source_xy
static uint8_t _cargo_periods
static Money _cargo_feeder_share
std::list< CargoPacket * > _packets
uint32_t _old_num_dests
static OldPersistentStorage _old_st_persistent_storage
static const SaveLoad _old_station_desc []
static const SaveLoad _station_desc []
static const STNSChunkHandler STNS
static const STNNChunkHandler STNN
static const ROADChunkHandler ROAD
static const ChunkHandlerRef station_chunk_handlers []

Detailed Description

Code handling saving and loading of stations.

Definition in file station_sl.cpp.

Typedef Documentation

◆ StationCargoPair

typedef std::pair<const StationID, std::list<CargoPacket *> > StationCargoPair

Definition at line 183 of file station_sl.cpp.

Function Documentation

◆ AfterLoadRoadStops()

void AfterLoadRoadStops ( )

(Re)building of road stop caches after loading a savegame.

Definition at line 145 of file station_sl.cpp.

References RoadStop::BaseEntry, IsDriveThroughStopTile(), NE, and NW.

Referenced by AfterLoadGame().

◆ AfterLoadStations()

void AfterLoadStations ( )

Definition at line 112 of file station_sl.cpp.

◆ MoveBuoysToWaypoints()

◆ SwapPackets()

void SwapPackets ( GoodsEntry * ge)
static

Swap the temporary packets with the packets without specific destination in the given goods entry.

Assert that at least one of those is empty.

Parameters
geGoods entry to swap with.

Definition at line 192 of file station_sl.cpp.

References GoodsEntry::GetOrCreateData().

Referenced by SlStationGoods::FixPointers(), and SlStationGoods::Load().

◆ UpdateWaypointOrder()

void UpdateWaypointOrder ( Order & o)
static

Update the buoy orders to be waypoint orders.

Parameters
othe order 'list' to check.

Definition at line 32 of file station_sl.cpp.

References SpecializedStation< Station, false >::Get(), Order::GetDestination(), Order::IsType(), Order::MakeGoToWaypoint(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), and Waypoint.

Referenced by MoveBuoysToWaypoints().

Variable Documentation

◆ _cargo_feeder_share

Money _cargo_feeder_share
static

Definition at line 171 of file station_sl.cpp.

◆ _cargo_periods

uint8_t _cargo_periods
static

Definition at line 170 of file station_sl.cpp.

◆ _cargo_source

uint16_t _cargo_source
static

Definition at line 168 of file station_sl.cpp.

◆ _cargo_source_xy

uint32_t _cargo_source_xy
static

Definition at line 169 of file station_sl.cpp.

◆ _old_num_dests

uint32_t _old_num_dests

Definition at line 174 of file station_sl.cpp.

◆ _old_num_flows

uint32_t _old_num_flows
static

Definition at line 167 of file station_sl.cpp.

◆ _old_st_persistent_storage

OldPersistentStorage _old_st_persistent_storage
static

Definition at line 185 of file station_sl.cpp.

◆ _old_station_desc

const SaveLoad _old_station_desc[]
static

Definition at line 488 of file station_sl.cpp.

◆ _packets

std::list<CargoPacket *> _packets

Definition at line 173 of file station_sl.cpp.

◆ _roadstop_desc

const SaveLoad _roadstop_desc[]
static
Initial value:
= {
}
#define SLE_OBJECT_ADDRESS(base, variable)
Macro to be able to pass the variable type and construct the SaveLoad::AddressFunction given a base c...
Definition saveload.h:754
A Stop for a Road Vehicle.
static SaveLoad Variable(std::string name, AddressFunction< T > address_func, SaveLoadVersion from=SaveLoadVersion::MinVersion, SaveLoadVersion to=SaveLoadVersion::MaxVersion, size_t extra=0)
Storage of a variable in some savegame versions.
Definition saveload.h:926
static SaveLoad Reference(std::string name, AddressFunction< T > address_func, SaveLoadVersion from=SaveLoadVersion::MinVersion, SaveLoadVersion to=SaveLoadVersion::MaxVersion)
Storage of a reference to a pool element in some savegame versions.
Definition saveload.h:951

Definition at line 160 of file station_sl.cpp.

◆ _station_desc

const SaveLoad _station_desc[]
static
Initial value:
= {
SaveLoad::SaveByte("facilities", SLE_OBJECT_ADDRESS(BaseStation, facilities)),
}
@ NewGRFRoadStops
Saveload version: 303, GitHub pull request: 10144 NewGRF road stops.
Definition saveload.h:349
@ RoadStopTileData
Saveload version: 340, GitHub pull request: 12883 Move storage of road stop tile data,...
Definition saveload.h:394
@ NewGRFStations
Saveload version: 27, SVN revision: 4757 NewGRF graphics for stations.
Definition saveload.h:82
Base class for all station-ish types.
static SaveLoad StructList(std::string name, SaveLoadVersion from=SaveLoadVersion::MinVersion, SaveLoadVersion to=SaveLoadVersion::MaxVersion)
Storage of a list of structs, optionally in some savegame versions.
Definition saveload.h:1103
static SaveLoad SaveByte(std::string name, AddressFunction< T > address_func, SaveLoadVersion from=SaveLoadVersion::MinVersion, SaveLoadVersion to=SaveLoadVersion::MaxVersion)
Storage of a byte variable in some savegame versions that is not automatically read by the SaveLoad c...
Definition saveload.h:1125
static SaveLoad Struct(std::string name, SaveLoadVersion from=SaveLoadVersion::MinVersion, SaveLoadVersion to=SaveLoadVersion::MaxVersion)
Storage of a structs, optionally in some savegame versions.
Definition saveload.h:1001

Definition at line 716 of file station_sl.cpp.

◆ _waiting_acceptance

uint16_t _waiting_acceptance
static

Definition at line 166 of file station_sl.cpp.

◆ ROAD

const ROADChunkHandler ROAD
static

Definition at line 804 of file station_sl.cpp.

◆ station_chunk_handlers

const ChunkHandlerRef station_chunk_handlers[]
static
Initial value:
= {
STNS,
STNN,
ROAD,
}

Definition at line 805 of file station_sl.cpp.

◆ STNN

const STNNChunkHandler STNN
static

Definition at line 803 of file station_sl.cpp.

◆ STNS

const STNSChunkHandler STNS
static

Definition at line 802 of file station_sl.cpp.