summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2021-06-06 11:21:39 +0200
committerPatric Stout <github@truebrain.nl>2021-06-10 19:18:24 +0200
commit8f323855b11faa039ce547cff9826be8e5437555 (patch)
tree972b62c04fd6f40334eeb19b9dac169faf65e846
parentaa6443d57a6e821fabeee65541d3eb869b96772b (diff)
downloadopenttd-8f323855b11faa039ce547cff9826be8e5437555.tar.xz
Codechange: rename SL_LST to SL_REFLIST to highlight the "reference" part
You can easily mistake SlList / SL_LST to be a list of SL_VAR, but it is a list of SL_REF. With this rename, it hopefully saves a few people from "wtf?" moments.
-rw-r--r--src/saveload/linkgraph_sl.cpp4
-rw-r--r--src/saveload/saveload.cpp14
-rw-r--r--src/saveload/saveload.h32
-rw-r--r--src/saveload/station_sl.cpp8
-rw-r--r--src/saveload/town_sl.cpp2
-rw-r--r--src/saveload/vehicle_sl.cpp2
6 files changed, 31 insertions, 31 deletions
diff --git a/src/saveload/linkgraph_sl.cpp b/src/saveload/linkgraph_sl.cpp
index 470d00be4..0640dba19 100644
--- a/src/saveload/linkgraph_sl.cpp
+++ b/src/saveload/linkgraph_sl.cpp
@@ -87,8 +87,8 @@ SaveLoadTable GetLinkGraphJobDesc()
SaveLoadTable GetLinkGraphScheduleDesc()
{
static const SaveLoad schedule_desc[] = {
- SLE_LST(LinkGraphSchedule, schedule, REF_LINK_GRAPH),
- SLE_LST(LinkGraphSchedule, running, REF_LINK_GRAPH_JOB),
+ SLE_REFLIST(LinkGraphSchedule, schedule, REF_LINK_GRAPH),
+ SLE_REFLIST(LinkGraphSchedule, running, REF_LINK_GRAPH_JOB),
};
return schedule_desc;
}
diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp
index 733ff509d..805934858 100644
--- a/src/saveload/saveload.cpp
+++ b/src/saveload/saveload.cpp
@@ -1334,7 +1334,7 @@ public:
* @param list The std::list to find the size of.
* @param conv VarType type of variable that is used for calculating the size.
*/
-static inline size_t SlCalcListLen(const void *list, VarType conv)
+static inline size_t SlCalcRefListLen(const void *list, VarType conv)
{
return SlStorageHelper<std::list, void *>::SlCalcLen(list, conv, SL_REF);
}
@@ -1344,11 +1344,11 @@ static inline size_t SlCalcListLen(const void *list, VarType conv)
* @param list The list being manipulated.
* @param conv VarType type of variable that is used for calculating the size.
*/
-static void SlList(void *list, VarType conv)
+static void SlRefList(void *list, VarType conv)
{
/* Automatically calculate the length? */
if (_sl.need_length != NL_NONE) {
- SlSetLength(SlCalcListLen(list, conv));
+ SlSetLength(SlCalcRefListLen(list, conv));
/* Determine length only? */
if (_sl.need_length == NL_CALCLENGTH) return;
}
@@ -1430,7 +1430,7 @@ size_t SlCalcObjMemberLength(const void *object, const SaveLoad &sld)
case SL_REF:
case SL_ARR:
case SL_STR:
- case SL_LST:
+ case SL_REFLIST:
case SL_DEQUE:
case SL_STDSTR:
/* CONDITIONAL saveload types depend on the savegame version */
@@ -1441,7 +1441,7 @@ size_t SlCalcObjMemberLength(const void *object, const SaveLoad &sld)
case SL_REF: return SlCalcRefLen();
case SL_ARR: return SlCalcArrayLen(sld.length, sld.conv);
case SL_STR: return SlCalcStringLen(GetVariableAddress(object, sld), sld.length, sld.conv);
- case SL_LST: return SlCalcListLen(GetVariableAddress(object, sld), sld.conv);
+ case SL_REFLIST: return SlCalcRefListLen(GetVariableAddress(object, sld), sld.conv);
case SL_DEQUE: return SlCalcDequeLen(GetVariableAddress(object, sld), sld.conv);
case SL_STDSTR: return SlCalcStdStringLen(GetVariableAddress(object, sld));
default: NOT_REACHED();
@@ -1515,7 +1515,7 @@ static bool SlObjectMember(void *object, const SaveLoad &sld)
case SL_REF:
case SL_ARR:
case SL_STR:
- case SL_LST:
+ case SL_REFLIST:
case SL_DEQUE:
case SL_STDSTR:
/* CONDITIONAL saveload types depend on the savegame version */
@@ -1526,7 +1526,7 @@ static bool SlObjectMember(void *object, const SaveLoad &sld)
case SL_REF: SlSaveLoadRef(ptr, conv); break;
case SL_ARR: SlArray(ptr, sld.length, conv); break;
case SL_STR: SlString(ptr, sld.length, sld.conv); break;
- case SL_LST: SlList(ptr, conv); break;
+ case SL_REFLIST: SlRefList(ptr, conv); break;
case SL_DEQUE: SlDeque(ptr, conv); break;
case SL_STDSTR: SlStdString(ptr, sld.conv); break;
default: NOT_REACHED();
diff --git a/src/saveload/saveload.h b/src/saveload/saveload.h
index e320c7d8b..3a2427c93 100644
--- a/src/saveload/saveload.h
+++ b/src/saveload/saveload.h
@@ -495,10 +495,10 @@ typedef uint32 VarType;
enum SaveLoadType : byte {
SL_VAR = 0, ///< Save/load a variable.
SL_REF = 1, ///< Save/load a reference.
- SL_ARR = 2, ///< Save/load an array.
+ SL_ARR = 2, ///< Save/load a fixed-size array of #SL_VAR elements.
SL_STR = 3, ///< Save/load a string.
- SL_LST = 4, ///< Save/load a list.
- SL_DEQUE = 5, ///< Save/load a deque.
+ SL_REFLIST = 4, ///< Save/load a list of #SL_REF elements.
+ SL_DEQUE = 5, ///< Save/load a deque of #SL_VAR elements.
SL_STDSTR = 6, ///< Save/load a \c std::string.
/* non-normal save-load types */
SL_WRITEBYTE = 8,
@@ -557,7 +557,7 @@ using SaveLoadTable = span<const SaveLoad>;
#define SLE_CONDREF(base, variable, type, from, to) SLE_GENERAL(SL_REF, base, variable, type, 0, from, to, 0)
/**
- * Storage of an array in some savegame versions.
+ * Storage of a fixed-size array of #SL_VAR elements in some savegame versions.
* @param base Name of the class or struct containing the array.
* @param variable Name of the variable in the class or struct referenced by \a base.
* @param type Storage of the data in memory and in the savegame.
@@ -589,17 +589,17 @@ using SaveLoadTable = span<const SaveLoad>;
#define SLE_CONDSSTR(base, variable, type, from, to) SLE_GENERAL(SL_STDSTR, base, variable, type, 0, from, to, 0)
/**
- * Storage of a list in some savegame versions.
+ * Storage of a list of #SL_REF elements in some savegame versions.
* @param base Name of the class or struct containing the list.
* @param variable Name of the variable in the class or struct referenced by \a base.
* @param type Storage of the data in memory and in the savegame.
* @param from First savegame version that has the list.
* @param to Last savegame version that has the list.
*/
-#define SLE_CONDLST(base, variable, type, from, to) SLE_GENERAL(SL_LST, base, variable, type, 0, from, to, 0)
+#define SLE_CONDREFLIST(base, variable, type, from, to) SLE_GENERAL(SL_REFLIST, base, variable, type, 0, from, to, 0)
/**
- * Storage of a deque in some savegame versions.
+ * Storage of a deque of #SL_VAR elements in some savegame versions.
* @param base Name of the class or struct containing the list.
* @param variable Name of the variable in the class or struct referenced by \a base.
* @param type Storage of the data in memory and in the savegame.
@@ -625,7 +625,7 @@ using SaveLoadTable = span<const SaveLoad>;
#define SLE_REF(base, variable, type) SLE_CONDREF(base, variable, type, SL_MIN_VERSION, SL_MAX_VERSION)
/**
- * Storage of an array in every version of a savegame.
+ * Storage of fixed-size array of #SL_VAR elements in every version of a savegame.
* @param base Name of the class or struct containing the array.
* @param variable Name of the variable in the class or struct referenced by \a base.
* @param type Storage of the data in memory and in the savegame.
@@ -651,12 +651,12 @@ using SaveLoadTable = span<const SaveLoad>;
#define SLE_SSTR(base, variable, type) SLE_CONDSSTR(base, variable, type, SL_MIN_VERSION, SL_MAX_VERSION)
/**
- * Storage of a list in every savegame version.
+ * Storage of a list of #SL_REF elements in every savegame version.
* @param base Name of the class or struct containing the list.
* @param variable Name of the variable in the class or struct referenced by \a base.
* @param type Storage of the data in memory and in the savegame.
*/
-#define SLE_LST(base, variable, type) SLE_CONDLST(base, variable, type, SL_MIN_VERSION, SL_MAX_VERSION)
+#define SLE_REFLIST(base, variable, type) SLE_CONDREFLIST(base, variable, type, SL_MIN_VERSION, SL_MAX_VERSION)
/**
* Empty space in every savegame version.
@@ -709,7 +709,7 @@ using SaveLoadTable = span<const SaveLoad>;
#define SLEG_CONDREF(variable, type, from, to) SLEG_GENERAL(SL_REF, variable, type, 0, from, to, 0)
/**
- * Storage of a global array in some savegame versions.
+ * Storage of a global fixed-size array of #SL_VAR elements in some savegame versions.
* @param variable Name of the global variable.
* @param type Storage of the data in memory and in the savegame.
* @param length Number of elements in the array.
@@ -738,13 +738,13 @@ using SaveLoadTable = span<const SaveLoad>;
#define SLEG_CONDSSTR(variable, type, from, to) SLEG_GENERAL(SL_STDSTR, variable, type, 0, from, to, 0)
/**
- * Storage of a global list in some savegame versions.
+ * Storage of a global reference list in some savegame versions.
* @param variable Name of the global variable.
* @param type Storage of the data in memory and in the savegame.
* @param from First savegame version that has the list.
* @param to Last savegame version that has the list.
*/
-#define SLEG_CONDLST(variable, type, from, to) SLEG_GENERAL(SL_LST, variable, type, 0, from, to, 0)
+#define SLEG_CONDREFLIST(variable, type, from, to) SLEG_GENERAL(SL_REFLIST, variable, type, 0, from, to, 0)
/**
* Storage of a global variable in every savegame version.
@@ -761,7 +761,7 @@ using SaveLoadTable = span<const SaveLoad>;
#define SLEG_REF(variable, type) SLEG_CONDREF(variable, type, SL_MIN_VERSION, SL_MAX_VERSION)
/**
- * Storage of a global array in every savegame version.
+ * Storage of a global fixed-size array of #SL_VAR elements in every savegame version.
* @param variable Name of the global variable.
* @param type Storage of the data in memory and in the savegame.
*/
@@ -782,11 +782,11 @@ using SaveLoadTable = span<const SaveLoad>;
#define SLEG_SSTR(variable, type) SLEG_CONDSSTR(variable, type, SL_MIN_VERSION, SL_MAX_VERSION)
/**
- * Storage of a global list in every savegame version.
+ * Storage of a global reference list in every savegame version.
* @param variable Name of the global variable.
* @param type Storage of the data in memory and in the savegame.
*/
-#define SLEG_LST(variable, type) SLEG_CONDLST(variable, type, SL_MIN_VERSION, SL_MAX_VERSION)
+#define SLEG_REFLIST(variable, type) SLEG_CONDREFLIST(variable, type, SL_MIN_VERSION, SL_MAX_VERSION)
/**
* Empty global space in some savegame versions.
diff --git a/src/saveload/station_sl.cpp b/src/saveload/station_sl.cpp
index 75b6043e7..92fa2bafd 100644
--- a/src/saveload/station_sl.cpp
+++ b/src/saveload/station_sl.cpp
@@ -207,7 +207,7 @@ static const SaveLoad _old_station_desc[] = {
SLE_CONDVAR(Station, waiting_triggers, SLE_UINT8, SLV_27, SL_MAX_VERSION),
SLE_CONDVAR(Station, num_specs, SLE_UINT8, SLV_27, SL_MAX_VERSION),
- SLE_CONDLST(Station, loading_vehicles, REF_VEHICLE, SLV_57, SL_MAX_VERSION),
+ SLE_CONDREFLIST(Station, loading_vehicles, REF_VEHICLE, SLV_57, SL_MAX_VERSION),
/* reserve extra space in savegame here. (currently 32 bytes) */
SLE_CONDNULL(32, SLV_2, SL_MAX_VERSION),
@@ -265,7 +265,7 @@ SaveLoadTable GetGoodsDesc()
SLEG_CONDVAR( _cargo_feeder_share, SLE_FILE_U32 | SLE_VAR_I64, SLV_14, SLV_65),
SLEG_CONDVAR( _cargo_feeder_share, SLE_INT64, SLV_65, SLV_68),
SLE_CONDVAR(GoodsEntry, amount_fract, SLE_UINT8, SLV_150, SL_MAX_VERSION),
- SLEG_CONDLST( _packets, REF_CARGO_PACKET, SLV_68, SLV_183),
+ SLEG_CONDREFLIST( _packets, REF_CARGO_PACKET, SLV_68, SLV_183),
SLEG_CONDVAR( _num_dests, SLE_UINT32, SLV_183, SL_MAX_VERSION),
SLE_CONDVAR(GoodsEntry, cargo.reserved_count, SLE_UINT, SLV_181, SL_MAX_VERSION),
SLE_CONDVAR(GoodsEntry, link_graph, SLE_UINT16, SLV_183, SL_MAX_VERSION),
@@ -281,7 +281,7 @@ typedef std::pair<const StationID, std::list<CargoPacket *> > StationCargoPair;
static const SaveLoad _cargo_list_desc[] = {
SLE_VAR(StationCargoPair, first, SLE_UINT16),
- SLE_LST(StationCargoPair, second, REF_CARGO_PACKET),
+ SLE_REFLIST(StationCargoPair, second, REF_CARGO_PACKET),
};
/**
@@ -426,7 +426,7 @@ static const SaveLoad _station_desc[] = {
SLE_VAR(Station, time_since_unload, SLE_UINT8),
SLE_VAR(Station, last_vehicle_type, SLE_UINT8),
SLE_VAR(Station, had_vehicle_of_type, SLE_UINT8),
- SLE_LST(Station, loading_vehicles, REF_VEHICLE),
+ SLE_REFLIST(Station, loading_vehicles, REF_VEHICLE),
SLE_CONDVAR(Station, always_accepted, SLE_FILE_U32 | SLE_VAR_U64, SLV_127, SLV_EXTEND_CARGOTYPES),
SLE_CONDVAR(Station, always_accepted, SLE_UINT64, SLV_EXTEND_CARGOTYPES, SL_MAX_VERSION),
};
diff --git a/src/saveload/town_sl.cpp b/src/saveload/town_sl.cpp
index 908ff2dd7..581d26cd7 100644
--- a/src/saveload/town_sl.cpp
+++ b/src/saveload/town_sl.cpp
@@ -189,7 +189,7 @@ static const SaveLoad _town_desc[] = {
SLE_CONDVAR(Town, larger_town, SLE_BOOL, SLV_56, SL_MAX_VERSION),
SLE_CONDVAR(Town, layout, SLE_UINT8, SLV_113, SL_MAX_VERSION),
- SLE_CONDLST(Town, psa_list, REF_STORAGE, SLV_161, SL_MAX_VERSION),
+ SLE_CONDREFLIST(Town, psa_list, REF_STORAGE, SLV_161, SL_MAX_VERSION),
SLE_CONDNULL(4, SLV_166, SLV_EXTEND_CARGOTYPES), ///< cargo_produced, no longer in use
SLE_CONDNULL(8, SLV_EXTEND_CARGOTYPES, SLV_REMOVE_TOWN_CARGO_CACHE), ///< cargo_produced, no longer in use
diff --git a/src/saveload/vehicle_sl.cpp b/src/saveload/vehicle_sl.cpp
index 7e9005779..260973050 100644
--- a/src/saveload/vehicle_sl.cpp
+++ b/src/saveload/vehicle_sl.cpp
@@ -629,7 +629,7 @@ SaveLoadTable GetVehicleDescription(VehicleType vt)
SLE_VAR(Vehicle, cargo_cap, SLE_UINT16),
SLE_CONDVAR(Vehicle, refit_cap, SLE_UINT16, SLV_182, SL_MAX_VERSION),
SLEG_CONDVAR( _cargo_count, SLE_UINT16, SL_MIN_VERSION, SLV_68),
- SLE_CONDLST(Vehicle, cargo.packets, REF_CARGO_PACKET, SLV_68, SL_MAX_VERSION),
+ SLE_CONDREFLIST(Vehicle, cargo.packets, REF_CARGO_PACKET, SLV_68, SL_MAX_VERSION),
SLE_CONDARR(Vehicle, cargo.action_counts, SLE_UINT, VehicleCargoList::NUM_MOVE_TO_ACTION, SLV_181, SL_MAX_VERSION),
SLE_CONDVAR(Vehicle, cargo_age_counter, SLE_UINT16, SLV_162, SL_MAX_VERSION),