33 const CargoPacketList *packets = v->cargo.Packets();
89 for (
auto it = cargo_list.
Packets()->begin(); it != cargo_list.
Packets()->end(); ++it) {
102 for (
auto it = v->cargo.Packets()->begin(); it != v->cargo.Packets()->end(); it++) {
104 (*it)->UpdateLoadingTile((*it)->source_xy);
113 for (
auto it = v->cargo.Packets()->begin(); it != v->cargo.Packets()->end(); it++) {
114 (*it)->in_vehicle =
true;
127 static const SaveLoad _cargopacket_desc[] = {
142 return _cargopacket_desc;
145struct CAPAChunkHandler : ChunkHandler {
146 CAPAChunkHandler() : ChunkHandler(
'CAPA', CH_TABLE) {}
153 SlSetArrayIndex(cp->index);
176extern const ChunkHandlerTable _cargopacket_chunk_handlers(cargopacket_chunk_handlers);
PoolID< uint32_t, struct CargoPacketIDTag, 0xFFF000, 0xFFFFFF > CargoPacketID
Unique identifier for a single cargo packet.
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.
const Tcont * Packets() const
Returns a pointer to the cargo packet list (so you can iterate over it etc).
CargoPacketList::const_iterator ConstIterator
void InvalidateCache()
Invalidates the cached data and rebuilds it.
static uint TileY(TileIndex tile)
Get the Y component of a tile.
static uint TileX(TileIndex tile)
Get the X component of a tile.
A number of safeguards to prevent using unsafe methods.
std::vector< SaveLoad > SlCompatTableHeader(const SaveLoadTable &slt, const SaveLoadCompatTable &slct)
Load a table header in a savegame compatible way.
int SlIterateArray()
Iterate through the elements of an array and read the whole thing.
void SlObject(void *object, const SaveLoadTable &slt)
Main SaveLoad function.
std::vector< SaveLoad > SlTableHeader(const SaveLoadTable &slt)
Save or Load a table header.
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.
Base classes/functions for stations.
Definition of base types and functions in a cross-platform compatible way.
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.
Money feeder_share
Value of feeder pickup to be paid for on delivery of cargo.
TileIndex source_xy
The origin of the cargo.
StationID next_hop
Station where the cargo wants to go next.
Source source
Source of the cargo.
CargoPacket(CargoPacketID index)
Create a new packet for savegame loading.
static void AfterLoad()
Savegame conversion for cargopackets.
uint16_t count
The amount of cargo in this packet.
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...
uint16_t periods_in_transit
Amount of cargo aging periods this packet has been in transit.
StationCargoList cargo
The cargo packets of cargo waiting in this station.
Stores station stats for a single cargo.
const GoodsEntryData & GetData() const
Get optional cargo packet/flow data.
bool HasData() const
Test if this goods entry has optional cargo packet/flow data.
static Pool::IterateWrapper< Vehicle > Iterate(size_t from=0)
static T * CreateAtIndex(CargoPacketID index, Targs &&... args)
static bool IsValidID(auto index)
static Pool::IterateWrapper< Station > Iterate(size_t from=0)
static Station * Get(auto index)
constexpr TileIndex INVALID_TILE
The very nice invalid tile marker.
Base class for all vehicles.