10 #include "../stdafx.h"
15 #include "../cargomonitor.h"
17 #include "../safeguards.h"
40 SB(number, 25, 4,
GB(number, 24, 4));
59 storage.number = iter->first;
60 storage.amount = iter->second;
82 if (fix) storage.number = FixupCargoMonitor(storage.number);
102 storage.number = iter->first;
103 storage.amount = iter->second;
125 if (fix) storage.number = FixupCargoMonitor(storage.number);
140 extern const ChunkHandlerTable _cargomonitor_chunk_handlers(cargomonitor_chunk_handlers);
constexpr T SB(T &x, const uint8_t s, const uint8_t n, const U d)
Set n bits in x starting at bit s to d.
constexpr static debug_inline uint GB(const T x, const uint8_t s, const uint8_t n)
Fetch n bits from x, started at bit s.
constexpr T ClrBit(T &x, const uint8_t y)
Clears a bit in a variable.
void ClearCargoDeliveryMonitoring(CompanyID company)
Clear all delivery cargo monitors.
CargoMonitorMap _cargo_deliveries
Map of monitored deliveries to the amount since last query/activation.
CargoMonitorMap _cargo_pickups
Map of monitored pick-ups to the amount since last query/activation.
void ClearCargoPickupMonitoring(CompanyID company)
Clear all pick-up cargo monitors.
uint32_t CargoMonitorID
Unique number for a company / cargo type / (town or industry).
static const SaveLoad _cargomonitor_pair_desc[]
Description of the TempStorage structure for the purpose of load and save.
static const CMDLChunkHandler CMDL
Chunk definition of the cargomonitoring maps.
Loading for cargomonitor chunks before table headers were added.
const SaveLoadCompat _cargomonitor_pair_sl_compat[]
Original field order for _cargomonitor_pair_desc.
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.
std::reference_wrapper< const ChunkHandler > ChunkHandlerRef
A reference to ChunkHandler.
std::span< const ChunkHandlerRef > ChunkHandlerTable
A table of ChunkHandler entries.
bool IsSavegameVersionBefore(SaveLoadVersion major, uint8_t minor=0)
Checks whether the savegame is below major.
@ SLV_FIX_CARGO_MONITOR
207 PR#7175 v1.9 Cargo monitor data packing fix to support 64 cargotypes.
#define SLE_VAR(base, variable, type)
Storage of a variable in every version of a savegame.
_cargo_deliveries monitoring map.
void Save() const override
Save the chunk.
void Load() const override
Load the chunk.
_cargo_pickups monitoring map.
void Load() const override
Load the chunk.
void Save() const override
Save the chunk.
Handlers and description of chunk.
Temporary storage of cargo monitoring data for loading or saving it.