Codechange: C++-ify lists for SaveLoad (#9323)

Basically, this changes "SaveLoad *" to either:
1) "SaveLoadTable" if a list of SaveLoads was meant
2) "SaveLoad &" if a single entry was meant

As added bonus, this removes SL_END / SLE_END / SLEG_END. This
also adds core/span.hpp, a "std::span"-lite.
This commit is contained in:
Patric Stout
2021-05-31 22:26:44 +02:00
committed by GitHub
parent 956d761e3e
commit 9fff00ba20
41 changed files with 213 additions and 223 deletions

View File

@@ -17,6 +17,7 @@
#include "cargo_type.h"
#include "vehicle_type.h"
#include "core/multimap.hpp"
#include "saveload/saveload.h"
#include <list>
/** Unique identifier for a single cargo packet. */
@@ -32,7 +33,7 @@ struct GoodsEntry; // forward-declare for Stage() and RerouteStalePackets()
template <class Tinst, class Tcont> class CargoList;
class StationCargoList; // forward-declare, so we can use it in VehicleCargoList.
extern const struct SaveLoad *GetCargoPacketDesc();
extern SaveLoadTable GetCargoPacketDesc();
typedef uint32 TileOrStationID;
@@ -58,7 +59,7 @@ private:
friend class VehicleCargoList;
friend class StationCargoList;
/** We want this to be saved, right? */
friend const struct SaveLoad *GetCargoPacketDesc();
friend SaveLoadTable GetCargoPacketDesc();
public:
/** Maximum number of items in a single cargo packet. */
static const uint16 MAX_COUNT = UINT16_MAX;
@@ -305,7 +306,7 @@ public:
/** The super class ought to know what it's doing. */
friend class CargoList<VehicleCargoList, CargoPacketList>;
/** The vehicles have a cargo list (and we want that saved). */
friend const struct SaveLoad *GetVehicleDescription(VehicleType vt);
friend SaveLoadTable GetVehicleDescription(VehicleType vt);
friend class CargoShift;
friend class CargoTransfer;
@@ -456,7 +457,7 @@ public:
/** The super class ought to know what it's doing. */
friend class CargoList<StationCargoList, StationCargoPacketMap>;
/** The stations, via GoodsEntry, have a CargoList. */
friend const struct SaveLoad *GetGoodsDesc();
friend SaveLoadTable GetGoodsDesc();
friend class CargoLoad;
friend class CargoTransfer;