10 #include "../stdafx.h"
15 #include "../vehicle_base.h"
16 #include "../station_base.h"
18 #include "../safeguards.h"
33 const CargoPacketList *packets = v->cargo.Packets();
96 for (
auto it = v->cargo.Packets()->begin(); it != v->cargo.Packets()->end(); it++) {
98 (*it)->UpdateLoadingTile((*it)->source_xy);
107 for (
auto it = v->cargo.Packets()->begin(); it != v->cargo.Packets()->end(); it++) {
108 (*it)->in_vehicle =
true;
121 static const SaveLoad _cargopacket_desc[] = {
136 return _cargopacket_desc;
147 SlSetArrayIndex(cp->index);
170 extern const ChunkHandlerTable _cargopacket_chunk_handlers(cargopacket_chunk_handlers);
SaveLoadTable GetCargoPacketDesc()
Wrapper function to get the CargoPacket's internal structure while some of the variables itself are p...
Loading for cargopacket chunks before table headers were added.
const SaveLoadCompat _cargopacket_sl_compat[]
Original field order for _cargopacket_desc.
Tcont::const_iterator ConstIterator
The const iterator for our container.
const Tcont * Packets() const
Returns a pointer to the cargo packet list (so you can iterate over it etc).
void InvalidateCache()
Invalidates the cached data and rebuilds it.
Hand-rolled multimap as map of lists.
static debug_inline uint TileY(TileIndex tile)
Get the Y component of a tile.
static debug_inline uint TileX(TileIndex tile)
Get the X component of a tile.
int SlIterateArray()
Iterate through the elements of an array and read the whole thing.
std::vector< SaveLoad > SlCompatTableHeader(const SaveLoadTable &slt, const SaveLoadCompatTable &slct)
Load a table header in a savegame compatible way.
std::vector< SaveLoad > SlTableHeader(const SaveLoadTable &slt)
Save or Load a table header.
void SlObject(void *object, const SaveLoadTable &slt)
Main SaveLoad function.
Functions/types related to saving and loading games.
#define SLE_VARNAME(base, variable, name, type)
Storage of a variable in every version of a savegame.
std::reference_wrapper< const ChunkHandler > ChunkHandlerRef
A reference to ChunkHandler.
std::span< const ChunkHandlerRef > ChunkHandlerTable
A table of ChunkHandler entries.
#define SLE_CONDVAR(base, variable, type, from, to)
Storage of a variable in some savegame versions.
bool IsSavegameVersionBefore(SaveLoadVersion major, uint8_t minor=0)
Checks whether the savegame is below major.
@ SL_MAX_VERSION
Highest possible saveload version.
@ SL_MIN_VERSION
First savegame version.
@ SLV_CARGO_TRAVELLED
319 PR#11283 CargoPacket now tracks how far it travelled inside a vehicle.
@ SLV_PERIODS_IN_TRANSIT_RENAME
316 PR#11112 Rename days in transit to (cargo) periods in transit.
@ SLV_MORE_CARGO_AGE
307 PR#10596 Track cargo age for a longer period.
@ SLV_REMOVE_LOADED_AT_XY
318 PR#11276 Remove loaded_at_xy variable from CargoPacket.
std::span< const struct SaveLoad > SaveLoadTable
A table of SaveLoad entries.
#define SLE_VAR(base, variable, type)
Storage of a variable in every version of a savegame.
#define SLE_CONDVARNAME(base, variable, name, type, from, to)
Storage of a variable in some savegame versions.
TileIndex xy
Base tile of the station.
void Load() const override
Load the chunk.
void Save() const override
Save the chunk.
Container for cargo from the same location and time.
TileIndex source_xy
The origin of the cargo.
static void AfterLoad()
Savegame conversion for cargopackets.
StationID first_station
The station where the cargo came from first.
Vector travelled
If cargo is in station: the vector from the unload tile to the source tile. If in vehicle: an interme...
Handlers and description of chunk.
Stores station stats for a single cargo.
StationCargoList cargo
The cargo packets of cargo waiting in this station.
static Pool::IterateWrapper< Titem > Iterate(size_t from=0)
Returns an iterable ensemble of all valid Titem.
static Pool::IterateWrapper< Station > Iterate(size_t from=0)
Returns an iterable ensemble of all valid stations of type T.
static Station * Get(size_t index)
Gets station with given index.
static bool IsValidID(size_t index)
Tests whether given index is a valid index for station of this type.
constexpr TileIndex INVALID_TILE
The very nice invalid tile marker.