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 {
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.
@ U16
A 16 bit unsigned int.
@ U8
A 8 bit unsigned int.
@ U32
A 32 bit unsigned int.
#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.
@ CargoTravelled
Saveload version: 319, GitHub pull request: 11283 CargoPacket now tracks how far it travelled inside...
@ CargoReservation
Saveload version: 181, SVN revision: 25012 Persist the reservation of cargo for vehicles instead of ...
@ PeriodsInTransitRename
Saveload version: 316, GitHub pull request: 11112 Rename days in transit to (cargo) periods in trans...
@ RemoveSubsidyStationBinding
Saveload version: 125, SVN revision: 17113 Awarded subsidies are not bound to stations,...
@ CargoSourceTile
Saveload version: 44, SVN revision: 8144 Store the source tile of the cargo, so accurate payment can...
@ MoreCargoAge
Saveload version: 307, GitHub pull request: 10596 Track cargo age for a longer period.
@ CompanyServiceIntervals
Saveload version: 120, SVN revision: 16439 Make service intervals configurable per company.
@ MinVersion
First savegame version.
@ RemoveLoadedAtXY
Saveload version: 318, GitHub pull request: 11276 Remove loaded_at_xy variable from CargoPacket.
@ CargoPackets
Saveload version: 68, SVN revision: 10266 Account for individual units of cargo, i....
@ MaxVersion
Highest possible saveload version.
std::span< const struct SaveLoad > SaveLoadTable
A table of SaveLoad entries.
@ Table
An Array with a header describing the elements.
#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.
Coord2D< int16_t > travelled
If cargo is in station: the vector from the unload tile to the source tile. If in vehicle: an interme...
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.
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)
static constexpr VarType U16
Store a 16 bits unsigned int.
static constexpr VarType U8
Store a 8 bits unsigned int.
static constexpr VarType I16
Store a 16 bits signed int.
static constexpr VarType I64
Store a 64 bits signed int.
static constexpr VarType U32
Store a 32 bits unsigned int.
constexpr TileIndex INVALID_TILE
The very nice invalid tile marker.
Base class for all vehicles.