OpenTTD Source 20260721-master-g25ec12c62d
saveload.h
Go to the documentation of this file.
1/*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
9
10#ifndef SAVELOAD_H
11#define SAVELOAD_H
12
13#include "saveload_type.h"
14#include "saveload_error.hpp"
15#include "saveload_func.h"
17#include "../fileio_type.h"
18#include "../fios.h"
19
33enum class SaveLoadVersion : uint16_t {
35
46
55
62
70
76
82
88
94
100
106
112
118
124
130
136
142
148
154
160
166
172
178
184
190
196
202
208
214
220
226
232
238
240 PersistentStoragePool,
244
250
256
262
268
274
280
286
290 ShipPathCache,
292
298
304
310
311 /* Patchpacks for a while considered it a good idea to jump a few versions
312 * above our version for their savegames. But as time continued, this gap
313 * has been closing, up to the point we would start to reuse versions from
314 * their patchpacks. This is not a problem from our perspective: the
315 * savegame will simply fail to load because they all contain chunks we
316 * cannot digest. But, this gives for ugly errors. As we have plenty of
317 * versions anyway, we simply skip the versions we know belong to
318 * patchpacks. This way we can present the user with a clean error
319 * indicate they are loading a savegame from a patchpack.
320 * For future patchpack creators: please follow a system like JGRPP, where
321 * the version is masked with 0x8000, and the true version is stored in
322 * its own chunk with feature toggles.
323 */
326
330
336
342
348
354
360
366
372
378
384
390
396
402
408
414
420
423
425};
426
436void SetSaveLoadError(StringID str);
437
438typedef void AutolengthProc(int);
439
441enum class ChunkType : uint8_t {
442 Riff = 0,
443 Array = 1,
445 Table = 3,
447
450};
451
454
459
466
468 virtual ~ChunkHandler() = default;
469
474 virtual void Save() const { NOT_REACHED(); }
475
480 virtual void Load() const = 0;
481
488 virtual void FixPointers() const {}
489
495 virtual void LoadCheck(size_t len = 0) const;
496
501 std::string GetName() const
502 {
503 return this->id.AsString();
504 }
505};
506
508using ChunkHandlerRef = std::reference_wrapper<const ChunkHandler>;
509
511using ChunkHandlerTable = std::span<const ChunkHandlerRef>;
512
514using SaveLoadCompatTable = std::span<const struct SaveLoadCompat>;
515
518public:
519 std::optional<std::vector<SaveLoad>> load_description;
520
522 virtual ~SaveLoadHandler() = default;
523
528 virtual void Save([[maybe_unused]] void *object) const {}
529
534 virtual void Load([[maybe_unused]] void *object) const {}
535
540 virtual void LoadCheck([[maybe_unused]] void *object) const {}
541
546 virtual void FixPointers([[maybe_unused]] void *object) const {}
547
552 virtual SaveLoadTable GetDescription() const = 0;
553
559
567};
568
580template <class TImpl, class TObject>
582public:
583 SaveLoadTable GetDescription() const override { return static_cast<const TImpl *>(this)->description; }
584
585 SaveLoadCompatTable GetCompatDescription() const override { return static_cast<const TImpl *>(this)->compat_description; }
586
591 virtual void Save([[maybe_unused]] TObject *object) const {}
592 void Save(void *object) const override { this->Save(static_cast<TObject *>(object)); }
593
598 virtual void Load([[maybe_unused]] TObject *object) const {}
599 void Load(void *object) const override { this->Load(static_cast<TObject *>(object)); }
600
605 virtual void LoadCheck([[maybe_unused]] TObject *object) const {}
606 void LoadCheck(void *object) const override { this->LoadCheck(static_cast<TObject *>(object)); }
607
612 virtual void FixPointers([[maybe_unused]] TObject *object) const {}
613 void FixPointers(void *object) const override { this->FixPointers(static_cast<TObject *>(object)); }
614};
615
630
632enum class VarFileType : uint8_t {
633 /* 4 bits allocated a maximum of 16 types for NumberType.
634 * NOTE: the SLE_FILE_NNN values are stored in the savegame! */
635 /* Value 0 is used to mark end-of-header in tables. Do not use here! */
636 I8 = 1,
637 U8 = 2,
638 I16 = 3,
639 U16 = 4,
640 I32 = 5,
641 U32 = 6,
642 I64 = 7,
643 U64 = 8,
645 String = 10,
646 Struct = 11,
647 /* 4 more possible file-primitives */
648};
649
651enum class VarMemType : uint8_t {
652 Bool = 0,
653 I8 = 1,
654 U8 = 2,
655 I16 = 3,
656 U16 = 4,
657 I32 = 5,
658 U32 = 6,
659 I64 = 7,
660 U64 = 8,
661 Null = 9,
662 Str = 12,
663 StrQ = 13,
664 Name = 14,
667};
668
670struct VarType {
675
677 constexpr VarType() {}
678
685
690 constexpr VarType(SLRefType ref) : ref(ref) {}
691
697 constexpr bool operator==(const VarType &other) const = default;
698
704 constexpr VarType operator|(StringValidationSetting string_validation_setting) const
705 {
706 VarType copy = *this;
707 copy.string_validation_settings.Set(string_validation_setting);
708 return copy;
709 }
710};
711
719{
720 return {file, mem};
721}
722
741
743enum class SaveLoadType : uint8_t {
746 Struct = 2,
747
748 String = 4,
749
750 Array = 5,
751 Vector = 7,
754
755 SaveByte = 10,
756 Null = 11,
757
759};
760
761typedef void *SaveLoadAddrProc(void *base, size_t extra);
762
764struct SaveLoad {
765 std::string name;
768 uint16_t length;
771 SaveLoadAddrProc *address_proc;
772 size_t extra_data;
773 std::shared_ptr<SaveLoadHandler> handler;
774};
775
790
796inline constexpr size_t SlVarSize(VarMemType type)
797{
798 switch (type) {
799 case VarMemType::Bool: return sizeof(bool);
800 case VarMemType::I8: return sizeof(int8_t);
801 case VarMemType::U8: return sizeof(uint8_t);
802 case VarMemType::I16: return sizeof(int16_t);
803 case VarMemType::U16: return sizeof(uint16_t);
804 case VarMemType::I32: return sizeof(int32_t);
805 case VarMemType::U32: return sizeof(uint32_t);
806 case VarMemType::I64: return sizeof(int64_t);
807 case VarMemType::U64: return sizeof(uint64_t);
808 case VarMemType::Null: return sizeof(void *);
809 case VarMemType::Str: return sizeof(std::string);
810 case VarMemType::StrQ: return sizeof(std::string);
811 case VarMemType::Name: return sizeof(std::string);
812 case VarMemType::LabelReverse: return sizeof(BaseLabel);
813 case VarMemType::LabelForward: return sizeof(BaseLabel);
814 default: NOT_REACHED();
815 }
816}
817
826inline constexpr bool SlCheckVarSize(SaveLoadType cmd, VarType type, size_t length, size_t size)
827{
828 switch (cmd) {
829 case SaveLoadType::Variable: return SlVarSize(type.mem) == size;
830 case SaveLoadType::Reference: return sizeof(void *) == size;
831 case SaveLoadType::String: return SlVarSize(type.mem) == size;
832 case SaveLoadType::Array: return SlVarSize(type.mem) * length <= size; // Partial load of array is permitted.
833 case SaveLoadType::Vector: return sizeof(std::vector<void *>) == size;
834 case SaveLoadType::ReferenceList: return sizeof(std::list<void *>) == size;
835 case SaveLoadType::ReferenceVector: return sizeof(std::vector<void *>) == size;
836 case SaveLoadType::SaveByte: return true;
837 default: NOT_REACHED();
838 }
839}
840
854#define SLE_GENERAL_NAME(cmd, name, base, variable, type, length, from, to, extra) \
855 SaveLoad {name, cmd, type, length, from, to, [] (void *b, size_t) -> void * { \
856 static_assert(SlCheckVarSize(cmd, type, length, sizeof(static_cast<base *>(b)->variable))); \
857 static_assert((VarType{type}.mem != VarMemType::LabelReverse && VarType{type}.mem != VarMemType::LabelForward) || std::is_base_of_v<BaseLabel, decltype(base::variable)>); \
858 assert(b != nullptr); \
859 return const_cast<void *>(static_cast<const void *>(std::addressof(static_cast<base *>(b)->variable))); \
860 }, extra, nullptr}
861
874#define SLE_GENERAL(cmd, base, variable, type, length, from, to, extra) SLE_GENERAL_NAME(cmd, #variable, base, variable, type, length, from, to, extra)
875
884#define SLE_CONDVAR(base, variable, type, from, to) SLE_GENERAL(SaveLoadType::Variable, base, variable, type, 0, from, to, 0)
885
895#define SLE_CONDVARNAME(base, variable, name, type, from, to) SLE_GENERAL_NAME(SaveLoadType::Variable, name, base, variable, type, 0, from, to, 0)
896
905#define SLE_CONDREF(base, variable, type, from, to) SLE_GENERAL(SaveLoadType::Reference, base, variable, type, 0, from, to, 0)
906
916#define SLE_CONDARR(base, variable, type, length, from, to) SLE_GENERAL(SaveLoadType::Array, base, variable, type, length, from, to, 0)
917
928#define SLE_CONDARRNAME(base, variable, name, type, length, from, to) SLE_GENERAL_NAME(SaveLoadType::Array, name, base, variable, type, length, from, to, 0)
929
938#define SLE_CONDSSTR(base, variable, type, from, to) SLE_GENERAL(SaveLoadType::String, base, variable, type, 0, from, to, 0)
939
949#define SLE_CONDSSTRNAME(base, variable, name, type, from, to) SLE_GENERAL_NAME(SaveLoadType::String, name, base, variable, type, 0, from, to, 0)
950
959#define SLE_CONDREFLIST(base, variable, type, from, to) SLE_GENERAL(SaveLoadType::ReferenceList, base, variable, type, 0, from, to, 0)
960
969#define SLE_CONDREFVECTOR(base, variable, type, from, to) SLE_GENERAL(SaveLoadType::ReferenceVector, base, variable, type, 0, from, to, 0)
970
979#define SLE_CONDVECTOR(base, variable, type, from, to) SLE_GENERAL(SaveLoadType::Vector, base, variable, type, 0, from, to, 0)
980
989#define SLE_CONDVECTOR(base, variable, type, from, to) SLE_GENERAL(SaveLoadType::Vector, base, variable, type, 0, from, to, 0)
990
997#define SLE_VAR(base, variable, type) SLE_CONDVAR(base, variable, type, SaveLoadVersion::MinVersion, SaveLoadVersion::MaxVersion)
998
1006#define SLE_VARNAME(base, variable, name, type) SLE_CONDVARNAME(base, variable, name, type, SaveLoadVersion::MinVersion, SaveLoadVersion::MaxVersion)
1007
1014#define SLE_REF(base, variable, type) SLE_CONDREF(base, variable, type, SaveLoadVersion::MinVersion, SaveLoadVersion::MaxVersion)
1015
1023#define SLE_ARR(base, variable, type, length) SLE_CONDARR(base, variable, type, length, SaveLoadVersion::MinVersion, SaveLoadVersion::MaxVersion)
1024
1033#define SLE_ARRNAME(base, variable, name, type, length) SLE_CONDARRNAME(base, variable, name, type, length, SaveLoadVersion::MinVersion, SaveLoadVersion::MaxVersion)
1034
1041#define SLE_SSTR(base, variable, type) SLE_CONDSSTR(base, variable, type, SaveLoadVersion::MinVersion, SaveLoadVersion::MaxVersion)
1042
1050#define SLE_SSTRNAME(base, variable, name, type) SLE_CONDSSTRNAME(base, variable, name, type, SaveLoadVersion::MinVersion, SaveLoadVersion::MaxVersion)
1051
1058#define SLE_REFLIST(base, variable, type) SLE_CONDREFLIST(base, variable, type, SaveLoadVersion::MinVersion, SaveLoadVersion::MaxVersion)
1059
1066#define SLE_REFVECTOR(base, variable, type) SLE_CONDREFVECTOR(base, variable, type, SaveLoadVersion::MinVersion, SaveLoadVersion::MaxVersion)
1067
1078#define SLE_SAVEBYTE(base, variable) SLE_GENERAL(SaveLoadType::SaveByte, base, variable, {}, 0, SaveLoadVersion::MinVersion, SaveLoadVersion::MaxVersion, 0)
1079
1091#define SLEG_GENERAL(name, cmd, variable, type, length, from, to, extra) \
1092 SaveLoad {name, cmd, type, length, from, to, [] (void *, size_t) -> void * { \
1093 static_assert(SlCheckVarSize(cmd, type, length, sizeof(variable))); \
1094 return static_cast<void *>(std::addressof(variable)); }, extra, nullptr}
1095
1104#define SLEG_CONDVAR(name, variable, type, from, to) SLEG_GENERAL(name, SaveLoadType::Variable, variable, type, 0, from, to, 0)
1105
1114#define SLEG_CONDREF(name, variable, type, from, to) SLEG_GENERAL(name, SaveLoadType::Reference, variable, type, 0, from, to, 0)
1115
1125#define SLEG_CONDARR(name, variable, type, length, from, to) SLEG_GENERAL(name, SaveLoadType::Array, variable, type, length, from, to, 0)
1126
1135#define SLEG_CONDSSTR(name, variable, type, from, to) SLEG_GENERAL(name, SaveLoadType::String, variable, type, 0, from, to, 0)
1136
1144#define SLEG_CONDSTRUCT(name, handler, from, to) SaveLoad {name, SaveLoadType::Struct, {}, 0, from, to, nullptr, 0, std::make_shared<handler>()}
1145
1154#define SLEG_CONDREFLIST(name, variable, type, from, to) SLEG_GENERAL(name, SaveLoadType::ReferenceList, variable, type, 0, from, to, 0)
1155
1164#define SLEG_CONDVECTOR(name, variable, type, from, to) SLEG_GENERAL(name, SaveLoadType::Vector, variable, type, 0, from, to, 0)
1165
1173#define SLEG_CONDSTRUCTLIST(name, handler, from, to) SaveLoad {name, SaveLoadType::StructList, {}, 0, from, to, nullptr, 0, std::make_shared<handler>()}
1174
1181#define SLEG_VAR(name, variable, type) SLEG_CONDVAR(name, variable, type, SaveLoadVersion::MinVersion, SaveLoadVersion::MaxVersion)
1182
1189#define SLEG_REF(name, variable, type) SLEG_CONDREF(name, variable, type, SaveLoadVersion::MinVersion, SaveLoadVersion::MaxVersion)
1190
1198#define SLEG_ARR(name, variable, type, length) SLEG_CONDARR(name, variable, type, length, SaveLoadVersion::MinVersion, SaveLoadVersion::MaxVersion)
1199
1206#define SLEG_SSTR(name, variable, type) SLEG_CONDSSTR(name, variable, type, SaveLoadVersion::MinVersion, SaveLoadVersion::MaxVersion)
1207
1213#define SLEG_STRUCT(name, handler) SLEG_CONDSTRUCT(name, handler, SaveLoadVersion::MinVersion, SaveLoadVersion::MaxVersion)
1214
1221#define SLEG_REFLIST(name, variable, type) SLEG_CONDREFLIST(name, variable, type, SaveLoadVersion::MinVersion, SaveLoadVersion::MaxVersion)
1222
1229#define SLEG_VECTOR(name, variable, type) SLEG_CONDVECTOR(name, variable, type, SaveLoadVersion::MinVersion, SaveLoadVersion::MaxVersion)
1230
1236#define SLEG_STRUCTLIST(name, handler) SLEG_CONDSTRUCTLIST(name, handler, SaveLoadVersion::MinVersion, SaveLoadVersion::MaxVersion)
1237
1242#define SLC_VAR(name) {name, 0, SaveLoadVersion::MinVersion, SaveLoadVersion::MaxVersion}
1243
1250#define SLC_NULL(length, from, to) {{}, length, from, to}
1251
1258inline bool IsSavegameVersionBefore(SaveLoadVersion major, uint8_t minor = 0)
1259{
1261 extern uint8_t _sl_minor_version;
1262 return _sl_version < major || (minor > 0 && _sl_version == major && _sl_minor_version < minor);
1263}
1264
1273{
1275 return _sl_version <= major;
1276}
1277
1285inline bool SlIsObjectCurrentlyValid(SaveLoadVersion version_from, SaveLoadVersion version_to)
1286{
1287 extern const SaveLoadVersion SAVEGAME_VERSION;
1288 return version_from <= SAVEGAME_VERSION && SAVEGAME_VERSION < version_to;
1289}
1290
1299inline void *GetVariableAddress(const void *object, const SaveLoad &sld)
1300{
1301 /* Entry is a null-variable, mostly used to read old savegames etc. */
1302 if (sld.conv.mem == VarMemType::Null) {
1303 assert(sld.address_proc == nullptr);
1304 return nullptr;
1305 }
1306
1307 /* Everything else should be a non-null pointer. */
1308 assert(sld.address_proc != nullptr);
1309 return sld.address_proc(const_cast<void *>(object), sld.extra_data);
1310}
1311
1312int64_t ReadValue(const void *ptr, VarMemType conv);
1313void WriteValue(void *ptr, VarMemType conv, int64_t val);
1314
1315void SlSetArrayIndex(uint index);
1316static void SlSetArrayIndex(const ConvertibleThroughBase auto &index) { SlSetArrayIndex(index.base()); }
1317int SlIterateArray();
1318
1319void SlSetStructListLength(size_t length);
1320size_t SlGetStructListLength(size_t limit);
1321
1322void SlAutolength(AutolengthProc *proc, int arg);
1323size_t SlGetFieldLength();
1324void SlSetLength(size_t length);
1325size_t SlCalcObjMemberLength(const void *object, const SaveLoad &sld);
1326size_t SlCalcObjLength(const void *object, const SaveLoadTable &slt);
1327
1328uint8_t SlReadByte();
1329void SlReadString(std::string &str, size_t length);
1330void SlWriteByte(uint8_t b);
1331
1332void SlGlobList(const SaveLoadTable &slt);
1333void SlCopy(void *object, size_t length, VarType conv);
1334std::vector<SaveLoad> SlTableHeader(const SaveLoadTable &slt);
1335std::vector<SaveLoad> SlCompatTableHeader(const SaveLoadTable &slt, const SaveLoadCompatTable &slct);
1336void SlObject(void *object, const SaveLoadTable &slt);
1337
1343inline void SlSkipBytes(size_t length)
1344{
1345 for (; length != 0; length--) SlReadByte();
1346}
1347
1359template <class TImpl, class TObject, class TElementType, size_t MAX_LENGTH = UINT32_MAX>
1360class VectorSaveLoadHandler : public DefaultSaveLoadHandler<TImpl, TObject> {
1361public:
1367 virtual std::vector<TElementType> &GetVector(TObject *object) const = 0;
1368
1374 virtual size_t GetLength() const { return SlGetStructListLength(MAX_LENGTH); }
1375
1376 void Save(TObject *object) const override
1377 {
1378 auto &vector = this->GetVector(object);
1379 SlSetStructListLength(vector.size());
1380
1381 for (auto &item : vector) {
1382 SlObject(&item, this->GetDescription());
1383 }
1384 }
1385
1386 void Load(TObject *object) const override
1387 {
1388 auto &vector = this->GetVector(object);
1389 size_t count = this->GetLength();
1390
1391 vector.reserve(count);
1392 while (count-- > 0) {
1393 auto &item = vector.emplace_back();
1394 SlObject(&item, this->GetLoadDescription());
1395 }
1396 }
1397};
1398
1399#endif /* SAVELOAD_H */
Pool< EngineRenew, EngineRenewID, 16 > EngineRenewPool
Memory pool for engine renew elements.
constexpr Timpl & Set()
Set all bits.
Action of reserving cargo from a station to be loaded onto a vehicle.
Default handler for saving/loading an object to/from disk.
Definition saveload.h:581
void FixPointers(void *object) const override
A post-load callback to fix SaveLoadType::Reference integers into pointers.
Definition saveload.h:613
virtual void Load(TObject *object) const
Load the object from disk.
Definition saveload.h:598
void Save(void *object) const override
Save the object to disk.
Definition saveload.h:592
virtual void FixPointers(TObject *object) const
A post-load callback to fix SaveLoadType::Reference integers into pointers.
Definition saveload.h:612
SaveLoadTable GetDescription() const override
Get the description of the fields in the savegame.
Definition saveload.h:583
void LoadCheck(void *object) const override
Similar to load, but used only to validate savegames.
Definition saveload.h:606
SaveLoadCompatTable GetCompatDescription() const override
Get the pre-header description of the fields in the savegame.
Definition saveload.h:585
virtual void LoadCheck(TObject *object) const
Similar to load, but used only to validate savegames.
Definition saveload.h:605
void Load(void *object) const override
Load the object from disk.
Definition saveload.h:599
virtual void Save(TObject *object) const
Save the object to disk.
Definition saveload.h:591
Class for calculation jobs to be run on link graphs.
A connected component of a link graph.
Definition linkgraph.h:37
Handler for saving/loading an object to/from disk.
Definition saveload.h:517
virtual SaveLoadTable GetDescription() const =0
Get the description of the fields in the savegame.
virtual void Load(void *object) const
Load the object from disk.
Definition saveload.h:534
virtual SaveLoadCompatTable GetCompatDescription() const =0
Get the pre-header description of the fields in the savegame.
std::optional< std::vector< SaveLoad > > load_description
Description derived from savegame being loaded.
Definition saveload.h:519
virtual void FixPointers(void *object) const
A post-load callback to fix SaveLoadType::Reference integers into pointers.
Definition saveload.h:546
virtual void Save(void *object) const
Save the object to disk.
Definition saveload.h:528
virtual ~SaveLoadHandler()=default
Ensure the destructor of the sub classes are called as well.
SaveLoadTable GetLoadDescription() const
Get the description for how to load the chunk.
virtual void LoadCheck(void *object) const
Similar to load, but used only to validate savegames.
Definition saveload.h:540
Default handler for saving/loading a vector to/from disk.
Definition saveload.h:1360
virtual std::vector< TElementType > & GetVector(TObject *object) const =0
Get instance of vector to load/save.
void Load(TObject *object) const override
Load the object from disk.
Definition saveload.h:1386
void Save(TObject *object) const override
Save the object to disk.
Definition saveload.h:1376
virtual size_t GetLength() const
Get number of elements to load into vector.
Definition saveload.h:1374
A type is considered 'convertible through base()' when it has a 'base()' function that returns someth...
Types for standard in/out file operations.
Declarations for savegames operations.
SaveLoadVersion _sl_version
the major savegame version identifier
Definition saveload.cpp:81
uint8_t _sl_minor_version
the minor savegame version, DO NOT USE!
Definition saveload.cpp:82
const SaveLoadVersion SAVEGAME_VERSION
current savegame version
A type for 4 character labels/tags/ids in files that should be read/shown as is.
EnumBitSet< PauseMode, uint8_t > PauseModes
Bitset of PauseMode elements.
Definition openttd.h:83
EnumBitSet< RoadType, uint64_t > RoadTypes
Bitset of RoadType elements.
Definition road_type.h:33
VarMemType
The types/structures of data we have in memory.
Definition saveload.h:651
@ U64
A 64 bit unsigned int.
Definition saveload.h:660
@ Name
old custom name to be converted to a string pointer
Definition saveload.h:664
@ LabelForward
A 4 character Label, stored as-is.
Definition saveload.h:666
@ I8
A 8 bit signed int.
Definition saveload.h:653
@ U8
A 8 bit unsigned int.
Definition saveload.h:654
@ LabelReverse
A 4 character Label, stored in reverse.
Definition saveload.h:665
@ StrQ
string pointer enclosed in quotes
Definition saveload.h:663
@ Null
useful to write zeros in savegame.
Definition saveload.h:661
@ I16
A 16 bit signed int.
Definition saveload.h:655
@ Bool
A boolean value.
Definition saveload.h:652
@ U32
A 32 bit unsigned int.
Definition saveload.h:658
@ I32
A 32 bit signed int.
Definition saveload.h:657
@ I64
A 64 bit signed int.
Definition saveload.h:659
@ Str
string pointer
Definition saveload.h:662
@ U16
A 16 bit unsigned int.
Definition saveload.h:656
VarFileType
The types/structures of data that can be stored in the file.
Definition saveload.h:632
@ String
A string.
Definition saveload.h:645
@ U64
A 64 bit unsigned int.
Definition saveload.h:643
@ I8
A 8 bit signed int.
Definition saveload.h:636
@ U8
A 8 bit unsigned int.
Definition saveload.h:637
@ Struct
An arbitrary structure.
Definition saveload.h:646
@ I16
A 16 bit signed int.
Definition saveload.h:638
@ U32
A 32 bit unsigned int.
Definition saveload.h:641
@ StringID
StringID offset into strings-array.
Definition saveload.h:644
@ I32
A 32 bit signed int.
Definition saveload.h:640
@ I64
A 64 bit signed int.
Definition saveload.h:642
@ U16
A 16 bit unsigned int.
Definition saveload.h:639
constexpr VarType operator|(VarFileType file, VarMemType mem)
Transitional helper function to combine a file and memory storage configuration.
Definition saveload.h:718
SavegameType
Types of save games.
Definition saveload.h:428
@ TTDP1
TTDP savegame ( -//- ) (data at NW border).
Definition saveload.h:430
@ TTO
TTO savegame.
Definition saveload.h:433
@ TTD
TTD savegame (can be detected incorrectly).
Definition saveload.h:429
@ TTDP2
TTDP savegame in new format (data at SE border).
Definition saveload.h:431
@ Invalid
broken savegame (used internally)
Definition saveload.h:434
@ OTTD
OTTD savegame.
Definition saveload.h:432
std::vector< SaveLoad > SlCompatTableHeader(const SaveLoadTable &slt, const SaveLoadCompatTable &slct)
Load a table header in a savegame compatible way.
void SlWriteByte(uint8_t b)
Wrapper for writing a byte to the dumper.
Definition saveload.cpp:419
size_t SlGetStructListLength(size_t limit)
Get the length of this list; if it exceeds the limit, error out.
int SlIterateArray()
Iterate through the elements of an array and read the whole thing.
Definition saveload.cpp:747
void SlSkipBytes(size_t length)
Read in bytes from the file/data structure but don't do anything with them, discarding them in effect...
Definition saveload.h:1343
void SetSaveLoadError(StringID str)
Set the error message from outside of the actual loading/saving of the game (AfterLoadGame and friend...
void SlCopy(void *object, size_t length, VarType conv)
Copy a list of SaveLoadType::Variables to/from a savegame.
size_t SlGetFieldLength()
Get the length of the current object.
Definition saveload.cpp:873
std::reference_wrapper< const ChunkHandler > ChunkHandlerRef
A reference to ChunkHandler.
Definition saveload.h:508
SLRefType
Type of reference (SLE_REF, SLE_CONDREF).
Definition saveload.h:617
@ OldVehicle
Load/save an old-style reference to a vehicle (for pre-4.4 savegames).
Definition saveload.h:621
@ Storage
Load/save a reference to a persistent storage.
Definition saveload.h:626
void * GetVariableAddress(const void *object, const SaveLoad &sld)
Get the address of the variable.
Definition saveload.h:1299
constexpr bool SlCheckVarSize(SaveLoadType cmd, VarType type, size_t length, size_t size)
Check if a saveload cmd/type/length entry matches the size of the variable.
Definition saveload.h:826
std::span< const ChunkHandlerRef > ChunkHandlerTable
A table of ChunkHandler entries.
Definition saveload.h:511
bool SlIsObjectCurrentlyValid(SaveLoadVersion version_from, SaveLoadVersion version_to)
Checks if some version from/to combination falls within the range of the active savegame version.
Definition saveload.h:1285
SaveLoadType
Type of data saved.
Definition saveload.h:743
@ ReferenceList
Save/load a list of SaveLoadType::Reference elements.
Definition saveload.h:752
@ String
Save/load a std::string.
Definition saveload.h:748
@ Array
Save/load a fixed-size array of SaveLoadType::Variable elements.
Definition saveload.h:750
@ Variable
Save/load a variable.
Definition saveload.h:744
@ Vector
Save/load a vector of SaveLoadType::Variable elements.
Definition saveload.h:751
@ Reference
Save/load a reference.
Definition saveload.h:745
@ StructList
Save/load a list of structs.
Definition saveload.h:753
@ SaveByte
Save (but not load) a byte.
Definition saveload.h:755
@ ReferenceVector
Save/load a vector of SaveLoadType::Reference elements.
Definition saveload.h:758
void WriteValue(void *ptr, VarMemType conv, int64_t val)
Write the value of a setting.
Definition saveload.cpp:909
std::span< const struct SaveLoadCompat > SaveLoadCompatTable
A table of SaveLoadCompat entries.
Definition saveload.h:514
void SlSetLength(size_t length)
Sets the length of either a RIFF object or the number of items in an array.
Definition saveload.cpp:801
uint8_t SlReadByte()
Wrapper for reading a byte from the buffer.
Definition saveload.cpp:410
bool IsSavegameVersionBefore(SaveLoadVersion major, uint8_t minor=0)
Checks whether the savegame is below major.
Definition saveload.h:1258
size_t SlCalcObjLength(const void *object, const SaveLoadTable &slt)
Calculate the size of an object.
void SlObject(void *object, const SaveLoadTable &slt)
Main SaveLoad function.
SaveLoadVersion
SaveLoad versions Previous savegame versions, the trunk revision where they were introduced and the r...
Definition saveload.h:33
@ LastLoadingTick
Saveload version: 301, GitHub pull request: 9693 Store tick of last loading for vehicles.
Definition saveload.h:344
@ LargerTownCargoStatistics
Saveload version: 9.0, SVN revision: 1909 Increase size of passenger/mail production of this and pre...
Definition saveload.h:54
@ BigDates
Saveload version: 31, SVN revision: 5999 Change date from 1920 - 2090 to 0 - 5 000 000.
Definition saveload.h:84
@ IncreaseHouseLimit
Saveload version: 348, GitHub pull request: 12288 Increase house limit to 4096.
Definition saveload.h:400
@ BackupOrderState
Saveload version: 176, SVN revision: 24446 Put more of the state of a vehicle's orders (like latenes...
Definition saveload.h:258
@ CargoTravelled
Saveload version: 319, GitHub pull request: 11283 CargoPacket now tracks how far it travelled inside...
Definition saveload.h:365
@ CustomSeaLevel
Saveload version: 149, SVN revision: 20832 Setting to influence the sea level (amount of water).
Definition saveload.h:225
@ StoreIndustryCargo
Saveload version: 78, SVN revision: 11176 Store an industry's cargo, so it can be customised upon bu...
Definition saveload.h:140
@ StationRatingCheat
Saveload version: 320, GitHub pull request: 11346 Add cheat to fix station ratings at 100%.
Definition saveload.h:367
@ MoreEngineTypes
Saveload version: 95, SVN revision: 12924 Allow more than the original 255 engine types.
Definition saveload.h:161
@ OrdersOwnedByOrderlist
Saveload version: 354, GitHub pull request: 13948 Orders stored in OrderList, pool removed.
Definition saveload.h:407
@ ExtendCargotypes
Saveload version: 199, GitHub pull request: 6802 Extend cargotypes to 64.
Definition saveload.h:285
@ TrainSlopeSteepness
Saveload version: 133, SVN revision: 18674 Setting to increase steepness of slopes for trains under ...
Definition saveload.h:206
@ FractionProfitRunningTicks
Saveload version: 88, SVN revision: 12134 Store vehicle profits as a (fixed point) fraction,...
Definition saveload.h:152
@ UnifyWaypointAndStation
Saveload version: 123, SVN revision: 16909 Unify stations and waypoints.
Definition saveload.h:194
@ InfrastructureMaintenanceCosts
Saveload version: 166, SVN revision: 23415 Infrastructure can now cost some periodic fee.
Definition saveload.h:246
@ VehicleEconomyAge
Saveload version: 334, GitHub pull request: 12141, release: 14.0 Add vehicle age in economy year,...
Definition saveload.h:383
@ GroupReplaceWagonRemoval
Saveload version: 291, GitHub pull request: 7441 Per-group wagon removal flag.
Definition saveload.h:332
@ ImproveMultistop
Saveload version: 25, SVN revision: 4259 Improve the behaviour of RVs going to road stops.
Definition saveload.h:77
@ MonthlyBankruptcyCheck
Saveload version: 177, SVN revision: 24619 Check for bankruptcy on a monthly cycle.
Definition saveload.h:259
@ CompanyInauguratedPeriodV2
Saveload version: 349, GitHub pull request: 13448 Fix savegame storage for company inaugurated year ...
Definition saveload.h:401
@ DigitGroupSeparator
Saveload version: 118, SVN revision: 16129 Configurable digit group separator.
Definition saveload.h:188
@ GoalProgressPlaneAcceleration
Saveload version: 182, SVN revision: 25115, r25259, r25296 Goal status and plane acceleration fixes.
Definition saveload.h:265
@ BigCurrency
Saveload version: 1.0, releases: 0.1.x, 0.2.x Change currency from 32 to 64 bits.
Definition saveload.h:36
@ LiveryRefit
Saveload version: 35, SVN revision: 6602 NewGRF livery refits.
Definition saveload.h:89
@ MergeOptsPats
Saveload version: 97, SVN revision: 13256 Merge the OPTS and PATS chunks, i.e. all settings in one c...
Definition saveload.h:163
@ StringGamelog
Saveload version: 314, GitHub pull request: 10801 Use std::string in gamelog.
Definition saveload.h:359
@ GroupHierarchy
Saveload version: 189, SVN revision: 26450 Hierarchical vehicle subgroups.
Definition saveload.h:273
@ CountPaidForCargo
Saveload version: 45, SVN revision: 8501 Count the amount of cargo that was paid for.
Definition saveload.h:101
@ UnifyCurrency
Saveload version: 65, SVN revision: 10210 Make all variables related to currency 64 bits.
Definition saveload.h:125
@ DisasterVehState
Saveload version: 312, GitHub pull request: 10798 Explicit storage of disaster vehicle state.
Definition saveload.h:357
@ EndingYear
Saveload version: 218, GitHub pull request: 7747, release: 1.10 Configurable ending year.
Definition saveload.h:308
@ LinkgraphRestrictedFlow
Saveload version: 187, SVN revision: 25899 Linkgraph - restricted flows.
Definition saveload.h:271
@ FreightWeight
Saveload version: 39, SVN revision: 7269 Setting to increase the weight of cargo on freight trains.
Definition saveload.h:93
@ FifoLoading
Saveload version: 57, SVN revision: 9691 First-in-first-out loading of vehicles.
Definition saveload.h:115
@ LargerTownIterator
Saveload version: 11.0, SVN revision: 2033 Increase size of the town iterator.
Definition saveload.h:57
@ EndPatchpacks
Saveload version: 286 Last known patchpack to use a version just above ours.
Definition saveload.h:325
@ TimetableStartTicksFix
Saveload version: 322, GitHub pull request: 11557 Fix for missing convert timetable start from a dat...
Definition saveload.h:369
@ MoveSccEncoded
Saveload version: 169, SVN revision: 23816 Move SCC_ENCODED to the first StringControlCode.
Definition saveload.h:249
@ LinkgraphEdges
Saveload version: 304, GitHub pull request: 10314 Explicitly store link graph edges destination,...
Definition saveload.h:347
@ FairPlaySettings
Saveload version: 79, SVN revision: 11188 Add setting to disable exclusive rights in a town and givi...
Definition saveload.h:141
@ DockDockingtiles
Saveload version: 298, GitHub pull request: 9578 All tiles around docks may be docking tiles.
Definition saveload.h:340
@ FreeformEdges
Saveload version: 111, SVN revision: 15190 Allow terraforming along the edge of the map.
Definition saveload.h:180
@ RoadWaypoints
Saveload version: 338, GitHub pull request: 12572 Road waypoints.
Definition saveload.h:388
@ UnifyAnimationState
Saveload version: 43, SVN revision: 7642 Put all animation state information in same map bits.
Definition saveload.h:98
@ LargerUnitNumber
Saveload version: 8.0, SVN revision: 1786 Increase size of (vehicle) unit numbers.
Definition saveload.h:53
@ MoveSemaphoreBits
Saveload version: 15.0, SVN revision: 2499 Move rail signal bit for semaphores.
Definition saveload.h:63
@ ReplaceCustomNameArray
Saveload version: 84, SVN revision: 11822 Replace single fixed size array of custom names,...
Definition saveload.h:147
@ RemoveMinorVersion
Saveload version: 18, SVN revision: 3227 Remove the minor versions from savegames.
Definition saveload.h:68
@ IncreaseStationTypeFieldSize
Saveload version: 337, GitHub pull request: 12572 Increase size of StationType field in map array.
Definition saveload.h:387
@ LastVehicleType
Saveload version: 26, SVN revision: 4466 Store the last vehicle type at stations instead of the vehi...
Definition saveload.h:78
@ SavePatches
Saveload version: 22, SVN revision: 3726 Save state of patches (precursor of settings) in the savega...
Definition saveload.h:73
@ RoadLayoutPerTown
Saveload version: 113, SVN revision: 15340 Allow for different road layouts for each of the towns.
Definition saveload.h:182
@ SplitStationTypeFromGfxid
Saveload version: 72, SVN revision: 10601 Splits the encoding of station type from the graphics iden...
Definition saveload.h:133
@ NewGRFSuppliedStationName
Saveload version: 103, SVN revision: 14598 NewGRF industry supplying default names for nearby statio...
Definition saveload.h:170
@ PathCacheFormat
Saveload version: 346, GitHub pull request: 12345 Vehicle path cache format changed.
Definition saveload.h:398
@ IndustryText
Saveload version: 289, GitHub pull request: 8576, release: 1.11.0-RC1 Additional GS text for industr...
Definition saveload.h:329
@ Yapf
Saveload version: 28, SVN revision: 4987 Yet another path finder.
Definition saveload.h:80
@ MaxLengthAndReverseSignals
Saveload version: 159, SVN revision: 21962 Settings for reversing at signals, and maximum train,...
Definition saveload.h:237
@ ObjectTypeToPool
Saveload version: 186, SVN revision: 25833 Move object type from map to pool object.
Definition saveload.h:270
@ MultipleSignalTypes
Saveload version: 64, SVN revision: 10006 Multiple different signal types on the same (diagonal) til...
Definition saveload.h:123
@ PeriodsInTransitRename
Saveload version: 316, GitHub pull request: 11112 Rename days in transit to (cargo) periods in trans...
Definition saveload.h:362
@ SimplifyPlayerFace
Saveload version: 49, SVN revision: 8969 Simplify the storage of player face information.
Definition saveload.h:105
@ VehicleCurrencyStationChanges
Saveload version: 2.0, release: 0.3.0 Adding vehicle state, larger currency size for statistics,...
Definition saveload.h:37
@ TownTolerancePauseMode
Saveload version: 4.0, SVN revision: 1 Town council tolerance and pause mode.
Definition saveload.h:41
@ AircraftSpeedHolding
Saveload version: 50, SVN revision: 8973 Aircraft speed in km-ish/h and reduced speed in holding pat...
Definition saveload.h:107
@ SignTextColours
Saveload version: 363, GitHub pull request: 14743 Configurable sign text colors in scenario editor.
Definition saveload.h:418
@ CountIndividualCargoes
Saveload version: 170, SVN revision: 23826 Store the count of individual cargo delivery for a period...
Definition saveload.h:251
@ MaxLoanForCompany
Saveload version: 330, GitHub pull request: 11224 Separate max loan for each company.
Definition saveload.h:379
@ TrackRealAndAutoOrders
Saveload version: 158, SVN revision: 21933 Track which real and auto order is the current order.
Definition saveload.h:236
@ VehicleCentreAndZPos
Saveload version: 164, SVN revision: 23290 Vehicle centres are not fixed at 4/8 of the vehicle; chan...
Definition saveload.h:243
@ VirtualFeederSharePayment
Saveload version: 134, SVN revision: 18703 Pay a part of the virtual profit during a transfer to the...
Definition saveload.h:207
@ MaglevMonorailPaxWagonLivery
Saveload version: 85, SVN revision: 11874 Add livery for maglev/monorail passenger wagons.
Definition saveload.h:149
@ ShipCurvePenalty
Saveload version: 209, GitHub pull request: 7289 Configurable ship curve penalties.
Definition saveload.h:297
@ ScriptMemlimit
Saveload version: 215, GitHub pull request: 7516 Limit on AI/GS memory consumption.
Definition saveload.h:305
@ SimplifyPathfinderSettings
Saveload version: 87, SVN revision: 12129 Make it easier to select the pathfinder to use.
Definition saveload.h:151
@ RoadStopOccupancyPenalty
Saveload version: 130, SVN revision: 18404 Add configurable pathfinder penalty for an occupied road ...
Definition saveload.h:203
@ RemoveTownCargoCache
Saveload version: 219, GitHub pull request: 8258 Remove town cargo acceptance and production caches.
Definition saveload.h:309
@ NewGRFTownNames
Saveload version: 66, SVN revision: 10211 NewGRF provided town names.
Definition saveload.h:126
@ EconomyModeTimekeepingUnits
Saveload version: 327, GitHub pull request: 11341 Mode to display economy measurements in wallclock ...
Definition saveload.h:375
@ BigMap
Saveload version: 5.0, SVN revision: 1429 Making maps a different size than 256x256.
Definition saveload.h:47
@ DriveBackwards
Saveload version: 365, GitHub pull request: 15379 Trains can drive backwards.
Definition saveload.h:421
@ ProductionHistory
Saveload version: 343, GitHub pull request: 10541 Industry production history.
Definition saveload.h:394
@ MultipleRoadTypes
Saveload version: 61, SVN revision: 9892 Multiple road types for the same tile.
Definition saveload.h:120
@ MultitileDocks
Saveload version: 216, GitHub pull request: 7380 Multiple docks per station.
Definition saveload.h:306
@ LargerCargoSource
Saveload version: 7.0, SVN revision: 1770 With more stations, the size of the cargo source needed to...
Definition saveload.h:52
@ RailTrackTypeUnification
Saveload version: 48, SVN revision: 8935 Put all the rail track type information in same map bits.
Definition saveload.h:104
@ AnimatedTileStateInMap
Saveload version: 347, GitHub pull request: 13082 Animated tile state saved for improved performance...
Definition saveload.h:399
@ NewGRFIndustryRandomTriggers
Saveload version: 82, SVN revision: 11410 NewGRF random triggers for industries.
Definition saveload.h:145
@ NewGRFLastService
Saveload version: 317, GitHub pull request: 11124 Added stable date_of_last_service to avoid NewGRF ...
Definition saveload.h:363
@ LinkgraphSeconds
Saveload version: 308, GitHub pull request: 10610 Store linkgraph update intervals in seconds instea...
Definition saveload.h:352
@ GroupLiveries
Saveload version: 205, GitHub pull request: 7108 Livery storage change and group liveries.
Definition saveload.h:293
@ DisableTownLevelCrossing
Saveload version: 143, SVN revision: 20048 Setting to be able to disable building rail/road crossing...
Definition saveload.h:218
@ ShipAcceleration
Saveload version: 329, GitHub pull request: 10734 Start using Vehicle's acceleration field for ships...
Definition saveload.h:377
@ MaximumDepotPenalty
Saveload version: 131, SVN revision: 18481 Add configurable maximum pathfinder penalty for finding a...
Definition saveload.h:204
@ GamelogEmergency
Saveload version: 116, SVN revision: 15893, release: 0.7.x Gamelog event for emergency/crash saves.
Definition saveload.h:186
@ NewGRFPersistentStorage
Saveload version: 76, SVN revision: 11139 Persistently store some state of NewGRF objects/entities.
Definition saveload.h:138
@ SaveYapfSettings
Saveload version: 33, SVN revision: 6440 Some YAPF settings were not saved properly.
Definition saveload.h:86
@ TownAcceptance
Saveload version: 127, SVN revision: 17439 Store mask of cargos accepted by town houses and head qua...
Definition saveload.h:199
@ Distinguish16
Saveload version: 195, SVN revision: 27572, release: 1.6.1 Convenience bump to distinguish 1....
Definition saveload.h:281
@ MoreCargoPackets
Saveload version: 69, SVN revision: 10319 Allow more than ~65k cargo packets.
Definition saveload.h:129
@ LinkgraphLocationDisasterStore
Saveload version: 191, SVN revision: 26636, 26646 Fix disaster vehicle storage, Linkgraph - store lo...
Definition saveload.h:276
@ FixTreeGround
Saveload version: 81, SVN revision: 11244 Various fixes to improve the visuals of the ground under t...
Definition saveload.h:144
@ DriveThroughRoadStops
Saveload version: 47, SVN revision: 8735 Drive through road stops.
Definition saveload.h:103
@ U64TickCounter
Saveload version: 300, GitHub pull request: 10035 Make tick counter 64bit to avoid wrapping.
Definition saveload.h:343
@ MoreWaypointsPerTown
Saveload version: 89, SVN revision: 12160 Support more than 64 waypoints per town.
Definition saveload.h:153
@ TownGrowthControl
Saveload version: 54, SVN revision: 9613 Give the player control over the town growth.
Definition saveload.h:111
@ TransferOrder
Saveload version: 14.0, SVN revision: 2441 Transfer orders for feeder systems.
Definition saveload.h:61
@ SeparateOrderTravelWaitTime
Saveload version: 190, SVN revision: 26547 Separate order travel and wait times.
Definition saveload.h:275
@ RobustEnginePreview
Saveload version: 179, SVN revision: 24810 Make engine preview offers robust when company ranking ch...
Definition saveload.h:261
@ EncodedStringFormat
Saveload version: 350, GitHub pull request: 13499 Encoded String format changed.
Definition saveload.h:403
@ CleanupUnconnectedRoads
Saveload version: 77, SVN revision: 11172 Option to remove unconnected roads during a town's road re...
Definition saveload.h:139
@ AirportAnimationFrames
Saveload version: 137, SVN revision: 18912 Use animation frames instead of many airport tile ids for...
Definition saveload.h:211
@ IndustryManagement
Saveload version: 152, SVN revision: 21171 Manage the amount of industries that ought to be spawned ...
Definition saveload.h:229
@ FractionalCargoDelivery
Saveload version: 150, SVN revision: 20857 When spreading cargo over stations, spread fractional amo...
Definition saveload.h:227
@ RemoveAutosaveInterval
Saveload version: 23, SVN revision: 3915 Store autosave interval locally, instead of in savegame.
Definition saveload.h:74
@ RoadvehPathCache
Saveload version: 211, GitHub pull request: 7261 Add path cache for road vehicles.
Definition saveload.h:300
@ LinkWaypointToTown
Saveload version: 12.1, SVN revision: 2046 Link waypoints to towns and remove some bit stuffing.
Definition saveload.h:59
@ RemoveHouseCount
Saveload version: 92, SVN revision: 12381, release 0.6.x Remove number of houses in a town from the ...
Definition saveload.h:157
@ NewGRFHouses
Saveload version: 53, SVN revision: 9316 NewGRF controlled houses.
Definition saveload.h:110
@ FoundTown
Saveload version: 128, SVN revision: 18281 Founding of new towns.
Definition saveload.h:200
@ NonfloodingWaterTiles
Saveload version: 345, GitHub pull request: 13013 Store water tile non-flooding state.
Definition saveload.h:397
@ FixSccEncodedNegative
Saveload version: 353, GitHub pull request: 14049 Fix encoding of negative parameters.
Definition saveload.h:406
@ RefitOrders
Saveload version: 36, SVN revision: 6624 Vehicles can be refitted as part of an order.
Definition saveload.h:90
@ NewGRFRoadStops
Saveload version: 303, GitHub pull request: 10144 NewGRF road stops.
Definition saveload.h:346
@ RemoveOldPathfinder
Saveload version: 212, GitHub pull request: 7245 Remove OPF.
Definition saveload.h:301
@ ExtendIndustryCargoSlots
Saveload version: 202, GitHub pull request: 6867 Increase industry cargo slots to 16 in,...
Definition saveload.h:289
@ Rivers
Saveload version: 163, SVN revision: 22767 Rivers.
Definition saveload.h:242
@ UnifyGroundVehicles
Saveload version: 157, SVN revision: 21862 Unify the way ground vehicles are handled (articulated pa...
Definition saveload.h:235
@ RemoveSubsidyStationBinding
Saveload version: 125, SVN revision: 17113 Awarded subsidies are not bound to stations,...
Definition saveload.h:197
@ Autoslope
Saveload version: 75, SVN revision: 11107 Terraforming under buildings/track/anything that supports ...
Definition saveload.h:137
@ ImprovedOrders
Saveload version: 93, SVN revision: 12648 Orders support all full load/non stop types at the same ti...
Definition saveload.h:158
@ CargoSourceTile
Saveload version: 44, SVN revision: 8144 Store the source tile of the cargo, so accurate payment can...
Definition saveload.h:99
@ UngroupedVehicles
Saveload version: 71, SVN revision: 10567 Add a group with vehicles that aren't in any other group.
Definition saveload.h:132
@ Utf8
Saveload version: 37, SVN revision: 7182 UTF-8 strings.
Definition saveload.h:91
@ DisableElrailSetting
Saveload version: 38, SVN revision: 7195 Add setting to disable electrified rails.
Definition saveload.h:92
@ VehMotionCounter
Saveload version: 288, GitHub pull request: 8591 Desync safe motion counter.
Definition saveload.h:328
@ TimetableStartTicks
Saveload version: 321, GitHub pull request: 11468 Convert timetable start from a date to ticks.
Definition saveload.h:368
@ AIStartDate
Saveload version: 309, GitHub pull request: 10653 Removal of individual AI start dates and added a g...
Definition saveload.h:353
@ StoreAirportSize
Saveload version: 140, SVN revision: 19382 Store the size of the airport in the station.
Definition saveload.h:215
@ DepotsUnderBridges
Saveload version: 366, GitHub pull request: 15836 Allow depots under bridges.
Definition saveload.h:422
@ ExtendEntityMapping
Saveload version: 311, GitHub pull request: 10672 Extend entity mapping range.
Definition saveload.h:356
@ StoreWaypointIdInMap
Saveload version: 17.0, SVN revision: 3212 Store the ID of waypoints in m2 of the map.
Definition saveload.h:66
@ BuoysAt0_0
Saveload version: 364, GitHub pull request: 14983 Allow to build buoys at (0x0).
Definition saveload.h:419
@ PlatformStopLocation
Saveload version: 117, SVN revision: 16037 Set the platform stop location via train orders.
Definition saveload.h:187
@ CurrentOrderMaxSpeed
Saveload version: 174, SVN revision: 23973, release: 1.2.x Save maximum speed of current order.
Definition saveload.h:255
@ Distinguish17
Saveload version: 196, SVN revision: 27778, release: 1.7 Convenience bump to distinguish 1....
Definition saveload.h:282
@ SeparateRoadOwners
Saveload version: 114, SVN revision: 15601 Separate owners for road bits, tram bits and the road sto...
Definition saveload.h:183
@ TableChunks
Saveload version: 295, GitHub pull request: 9322 Introduction of ChunkType::Table and ChunkType::Spa...
Definition saveload.h:337
@ MoreCompanies
Saveload version: 104, SVN revision: 14735 Increase maximum number of companies to 15.
Definition saveload.h:171
@ NewGRFPalette
Saveload version: 101, SVN revision: 14233 Store palette used by each of the NewGRFs.
Definition saveload.h:168
@ MultipleRoadStops
Saveload version: 6.0, SVN revision: 1721 Multi tile road stops, and some map size related fixes.
Definition saveload.h:50
@ MoreCargoAge
Saveload version: 307, GitHub pull request: 10596 Track cargo age for a longer period.
Definition saveload.h:351
@ SavegameId
Saveload version: 313, GitHub pull request: 10719 Add an unique ID to every savegame (used to dedupl...
Definition saveload.h:358
@ VehicleGroups
Saveload version: 60, SVN revision: 9874 Arbitrary grouping, by the player, of vehicles.
Definition saveload.h:119
@ UnifyAnimationFrame
Saveload version: 147, SVN revision: 20621 Unify location of animation frame.
Definition saveload.h:223
@ ServiceIntervalPercent
Saveload version: 180, SVN revision: 24998, release: 1.3.x Service interval in percent or days store...
Definition saveload.h:263
@ AutoreplaceWhenOldTreeLimit
Saveload version: 175, SVN revision: 24136 Autoreplace vehicle only when they are old,...
Definition saveload.h:257
@ CargoPayments
Saveload version: 121, SVN revision: 16694 Perform payment of cargo after unloading.
Definition saveload.h:192
@ MultitrackLevelCrossings
Saveload version: 302, GitHub pull request: 9931, release: 13.0 Multi-track level crossings.
Definition saveload.h:345
@ CompanyAllowListV2
Saveload version: 341, GitHub pull request: 12908 Fixed savegame format for saving of list of client...
Definition saveload.h:392
@ PlaneSpeedFactor
Saveload version: 90, SVN revision: 12293 Setting to increase aircraft speed to be on par with the o...
Definition saveload.h:155
@ AILocalConfig
Saveload version: 332, GitHub pull request: 12003 Config of running AI is stored inside Company.
Definition saveload.h:381
@ StationsUnderBridges
Saveload version: 359, GitHub pull request: 14477 Allow stations under bridges.
Definition saveload.h:413
@ DisallowTreeBuilding
Saveload version: 132, SVN revision: 18522 Setting to partially disable building of trees.
Definition saveload.h:205
@ CumulatedInflation
Saveload version: 126, SVN revision: 17433 Store cumulated inflation, and recalculate prices/payment...
Definition saveload.h:198
@ TownCargogen
Saveload version: 208, GitHub pull request: 6965 New algorithms for town building cargo generation.
Definition saveload.h:296
@ NewGRFCustomCargoAging
Saveload version: 162, SVN revision: 22713 NewGRF influence on aging of cargo in vehicles.
Definition saveload.h:241
@ DisallowRoadReconstruction
Saveload version: 160, SVN revision: 21974, release: 1.1.x Setting to disallow road reconstruction.
Definition saveload.h:239
@ NextCompetitorStartOverflow
Saveload version: 109, SVN revision: 15075 Prevent overflow in the next competitor start counter.
Definition saveload.h:177
@ TimetableTicksType
Saveload version: 323, GitHub pull request: 11435 Convert timetable current order time to ticks.
Definition saveload.h:370
@ NewGRFAircraftRange
Saveload version: 167, SVN revision: 23504 NewGRF provided maximum aircraft range.
Definition saveload.h:247
@ LargerTownCounter
Saveload version: 10.0, SVN revision: 2030 Increase size of the town counter.
Definition saveload.h:56
@ LinkgraphTravelTime
Saveload version: 297, GitHub pull request: 9457, release: 12.0-RC1 Store travel time in the linkgra...
Definition saveload.h:339
@ Cargodist
Saveload version: 183, SVN revision: 25363 Cargodist.
Definition saveload.h:266
@ Elrail
Saveload version: 24, SVN revision: 4150 Electrified railways.
Definition saveload.h:75
@ TownSupplyHistory
Saveload version: 358, GitHub pull request: 14461 Town supply history.
Definition saveload.h:412
@ FixCargoMonitor
Saveload version: 207, GitHub pull request: 7175, release: 1.9 Cargo monitor data packing fix to sup...
Definition saveload.h:295
@ StoreMapVariety
Saveload version: 197, SVN revision: 27978, release: 1.8 Store map variety.
Definition saveload.h:283
@ NewGRFIndustryLayout
Saveload version: 73, SVN revision: 10903 NewGRF provided layouts for industries.
Definition saveload.h:134
@ RemoveOldAISettings
Saveload version: 110, SVN revision: 15148 Remove remnants of the old AI's configuration.
Definition saveload.h:179
@ ExtendVehicleRandom
Saveload version: 310, GitHub pull request: 10701 Extend vehicle random bits.
Definition saveload.h:355
@ CompanyServiceIntervals
Saveload version: 120, SVN revision: 16439 Make service intervals configurable per company.
Definition saveload.h:191
@ EngineMultiRailtype
Saveload version: 362, GitHub pull request: 14357, release: 15.0 Train engines can have multiple rai...
Definition saveload.h:417
@ MoreAirportBlocks
Saveload version: 46, SVN revision: 8705 Increase number of blocks an airport can have.
Definition saveload.h:102
@ ReducePlaneCrashes
Saveload version: 138, SVN revision: 18942, release: 1.0.x Setting to reduce/disable crashing of pla...
Definition saveload.h:212
@ RoadTypeLabelMap
Saveload version: 344, GitHub pull request: 13021 Add road type label map to allow upgrade/conversio...
Definition saveload.h:395
@ RocksStayUnderSnow
Saveload version: 135, SVN revision: 18719 Rocks stay under snow, i.e. they return when the snow goe...
Definition saveload.h:209
@ WaterRegions
Saveload version: 324, GitHub pull request: 10543 Water Regions for ship pathfinder.
Definition saveload.h:371
@ MinVersion
First savegame version.
Definition saveload.h:34
@ EconomyDate
Saveload version: 326, GitHub pull request: 10700 Split calendar and economy timers and dates.
Definition saveload.h:374
@ IndustryAcceptedHistory
Saveload version: 357, GitHub pull request: 14321 Add per-industry history of cargo delivered and wa...
Definition saveload.h:411
@ ScenarioDeitySigns
Saveload version: 171, SVN revision: 23835 Signs made in scenarios become of OWNER_DEITY,...
Definition saveload.h:252
@ OrderMaxSpeed
Saveload version: 172, SVN revision: 23947 Set maximum speed for orders.
Definition saveload.h:253
@ NewGRFSettings
Saveload version: 41, SVN revision: 7348, release: 0.5.x Save what NewGRFs are used in the game and ...
Definition saveload.h:96
@ MoreUnderBridges
Saveload version: 29, SVN revision: 5070 Support crossings, fields and bridge/tunnel heads under bri...
Definition saveload.h:81
@ MoreHouseAnimationFrames
Saveload version: 91, SVN revision: 12347 Increase number of animation frames for NewGRF houses.
Definition saveload.h:156
@ TradingAge
Saveload version: 217, GitHub pull request: 7780 Configurable company trading age.
Definition saveload.h:307
@ WaypointMoreLikeStation
Saveload version: 122, SVN revision: 16855 Make waypoint data look more like stations.
Definition saveload.h:193
@ ExtendRailtypes
Saveload version: 200, GitHub pull request: 6805 Extend railtypes to 64, adding uint16_t to map arra...
Definition saveload.h:287
@ RemoveLoadedAtXY
Saveload version: 318, GitHub pull request: 11276 Remove loaded_at_xy variable from CargoPacket.
Definition saveload.h:364
@ StoreAIVersion
Saveload version: 108, SVN revision: 15045 Store the version of the AI script.
Definition saveload.h:176
@ VeryLowTownIndustryNumber
Saveload version: 58, SVN revision: 9762 Difficulty settings for very low number of industries and t...
Definition saveload.h:116
@ ProtectPlacedHouses
Saveload version: 351, GitHub pull request: 13270 Houses individually placed by players can be prote...
Definition saveload.h:404
@ SplitLoadWaitCounters
Saveload version: 136, SVN revision: 18764 Split counters for (un)loading and signal waiting/turning...
Definition saveload.h:210
@ Storybooks
Saveload version: 185, SVN revision: 25620 Storybooks.
Definition saveload.h:269
@ LeaveRoadStopSeparately
Saveload version: 153, SVN revision: 21263 Fix issue where multiple vehicles could leave a road stop...
Definition saveload.h:230
@ IndustryCargoReorganise
Saveload version: 315, GitHub pull request: 10853 Industry accepts/produced data reorganised.
Definition saveload.h:361
@ StatueOwner
Saveload version: 52, SVN revision: 9066 Store the owner of the statue, so the town can be informed ...
Definition saveload.h:109
@ CompanyAllowList
Saveload version: 335, GitHub pull request: 12337 Saving of list of client keys that are allowed to ...
Definition saveload.h:385
@ SplitHQ
Saveload version: 112, SVN revision: 15290 Split the behaviour of headquarters from the other unmova...
Definition saveload.h:181
@ UniqueDepotNames
Saveload version: 141, SVN revision: 19799 Give depots unique names.
Definition saveload.h:216
@ DepotWaterOwners
Saveload version: 83, SVN revision: 11589 Store the owner of the water under depots,...
Definition saveload.h:146
@ LargerAIStateCounter
Saveload version: 13.1, SVN revision: 2080, releases: 0.4.0, 0.4.0.1 AI state counter increased due ...
Definition saveload.h:60
@ StoreNewGRFVersion
Saveload version: 151, SVN revision: 20918 Store the version of the used NewGRFs.
Definition saveload.h:228
@ FeederShare
Saveload version: 51, SVN revision: 8978 Rewrite of transfers to retain knowledge about the already ...
Definition saveload.h:108
@ TownGrowthInGameTicks
Saveload version: 198, GitHub pull request: 6763 Switch town growth rate and counter to actual game ...
Definition saveload.h:284
@ NewGRFMoreAnimation
Saveload version: 80, SVN revision: 11228 Support more types of animation for NewGRF industries.
Definition saveload.h:143
@ Tgp
Saveload version: 30, SVN revision: 5946 TerraGenesis Perlin.
Definition saveload.h:83
@ DepotUnbunching
Saveload version: 331, GitHub pull request: 11945 Allow unbunching shared order vehicles at a depot.
Definition saveload.h:380
@ ScriptInt64
Saveload version: 296, GitHub pull request: 9415 SQInteger is 64bit but was saved as 32bit.
Definition saveload.h:338
@ ShipsStopInLocks
Saveload version: 206, GitHub pull request: 7150 Ship/lock movement changes.
Definition saveload.h:294
@ IndustryTileWaterClass
Saveload version: 99, SVN revision: 13838 Add water classes to industry tiles.
Definition saveload.h:165
@ ScriptRandomizer
Saveload version: 333, GitHub pull request: 12063, release: 14.0-RC1 Save script randomizers.
Definition saveload.h:382
@ RepairObjectDockingTiles
Saveload version: 299, GitHub pull request: 9594, release: 12.0 Fixing issue with docking tiles over...
Definition saveload.h:341
@ RemoveOldPbs
Saveload version: 21, SVN revision: 3472, release: 0.4.x Remove old implementation of path based sig...
Definition saveload.h:72
@ IndustryNumValidHistory
Saveload version: 356, GitHub pull request: 14416 Store number of valid history records for industri...
Definition saveload.h:410
@ NewGRFDepotBuildDate
Saveload version: 142, SVN revision: 20003 Depot build date for NewGRFs.
Definition saveload.h:217
@ BiggerStationVariables
Saveload version: 3.0 Increase size of airport blocks/station build date.
Definition saveload.h:40
@ NewGRFAirportSmoke
Saveload version: 145, SVN revision: 20376 NewGRF support for airport and configurable amount of smo...
Definition saveload.h:221
@ CompanyInauguratedPeriod
Saveload version: 339, GitHub pull request: 12798 Companies show the period inaugurated in wallclock...
Definition saveload.h:389
@ MapgenSettingsRevamp
Saveload version: 290, GitHub pull request: 8891, release: 1.11 Revamp of some mapgen settings (snow...
Definition saveload.h:331
@ FixStationPickupAccounting
Saveload version: 74, SVN revision: 11030 Accounting of which cargos a station would pick up was don...
Definition saveload.h:135
@ DistantStationJoining
Saveload version: 106, SVN revision: 14919 Distant joining of stations.
Definition saveload.h:174
@ SaveloadListLength
Saveload version: 293, GitHub pull request: 9374 Consistency in list length with SaveLoadType::Struc...
Definition saveload.h:334
@ CustomSubsidyDuration
Saveload version: 292, GitHub pull request: 9081 Configurable subsidy duration.
Definition saveload.h:333
@ VelocityNautical
Saveload version: 305, GitHub pull request: 10594 Separation of land and nautical velocity (knots!...
Definition saveload.h:349
@ CalendarSubDateFract
Saveload version: 328, GitHub pull request: 11428 Add sub_date_fract to measure calendar days.
Definition saveload.h:376
@ ShipRotation
Saveload version: 204, GitHub pull request: 7065 Add extra rotation stages for ships.
Definition saveload.h:291
@ CustomTownNumber
Saveload version: 115, SVN revision: 15695 Configuration for specific number of towns to build.
Definition saveload.h:185
@ Liveries
Saveload version: 34, SVN revision: 6455 Liveries and two company colours (2cc).
Definition saveload.h:87
@ Timetables
Saveload version: 67, SVN revision: 10236 Introduce timetables for vehicles.
Definition saveload.h:127
@ DocksUnderBridges
Saveload version: 360, GitHub pull request: 14594 Allow docks under bridges.
Definition saveload.h:415
@ WaterRegionEvalSimplified
Saveload version: 325, GitHub pull request: 11750 Simplified Water Region evaluation.
Definition saveload.h:373
@ GroupNumbers
Saveload version: 336, GitHub pull request: 12297 Add per-company group numbers.
Definition saveload.h:386
@ RvRealisticAcceleration
Saveload version: 139, SVN revision: 19346 Realistic acceleration of road vehicles.
Definition saveload.h:213
@ ServeNeutralIndustries
Saveload version: 210, GitHub pull request: 7234 Company stations can serve industries with attached...
Definition saveload.h:299
@ ReorderUnmovableRemoveReserved
Saveload version: 144, SVN revision: 20334 Reorder map bits of unmovable tiles and remove unused res...
Definition saveload.h:219
@ Yapp
Saveload version: 100, SVN revision: 13952 New version of path based signals.
Definition saveload.h:167
@ MultiTileWaypoints
Saveload version: 124, SVN revision: 16993 Waypoints can be bigger than a single tile.
Definition saveload.h:195
@ FaceStyles
Saveload version: 355, GitHub pull request: 14319 Addition of face styles, replacing gender and ethn...
Definition saveload.h:409
@ NewGRFCargo
Saveload version: 55, SVN revision: 9638 Increase number of cargos and NewGRF control of cargos.
Definition saveload.h:113
@ CargoPackets
Saveload version: 68, SVN revision: 10266 Account for individual units of cargo, i....
Definition saveload.h:128
@ TerraformLimits
Saveload version: 156, SVN revision: 21728 Introduce limits for terraforming and clearing times.
Definition saveload.h:234
@ SeparateLocaleUnits
Saveload version: 184, SVN revision: 25508 Unit localisation split.
Definition saveload.h:267
@ TreesWaterClass
Saveload version: 213, GitHub pull request: 7405 WaterClass update for tree tiles.
Definition saveload.h:302
@ AdjacentStations
Saveload version: 62, SVN revision: 9905 Allow building multiple stations directly next to eachother...
Definition saveload.h:121
@ UnifyRvTravelTime
Saveload version: 188, SVN revision: 26169, release: 1.4 Unify RV travel time.
Definition saveload.h:272
@ MaxBridgeMapHeight
Saveload version: 194, SVN revision: 26881, release: 1.5 Setting for maximum bridge and map height.
Definition saveload.h:279
@ TimetableStart
Saveload version: 129, SVN revision: 18292 Allow setting the start date of a timetable.
Definition saveload.h:201
@ ScriptSaveInstances
Saveload version: 352, GitHub pull request: 13556 Scripts are allowed to save instances.
Definition saveload.h:405
@ NewGRFObjectView
Saveload version: 155, SVN revision: 21453 Support for views in NewGRF objects.
Definition saveload.h:233
@ MaxVersion
Highest possible saveload version.
Definition saveload.h:424
@ NoMultiheadReference
Saveload version: 20, SVN revision: 3403 Remove reference from one multihead to the other one.
Definition saveload.h:71
@ IndustryPlatform
Saveload version: 148, SVN revision: 20659 Setting to make a flat area around (new) industries.
Definition saveload.h:224
@ ScriptTownGrowth
Saveload version: 165, SVN revision: 23304 Storage of cargo statistics for use by game scripts.
Definition saveload.h:245
@ SpreadIndustryProductionChanges
Saveload version: 102, SVN revision: 14332 Spread the industry production changes over the month,...
Definition saveload.h:169
@ PauseLevel
Saveload version: 154, SVN revision: 21426 Setting to determine what commands are allowed when pause...
Definition saveload.h:231
@ FixCompanyCargoTypes
Saveload version: 94, SVN revision: 12816 The company's cargo types should have increased in since w...
Definition saveload.h:159
@ GradualLoading
Saveload version: 40, SVN revision: 7326 Gradual (un)loading of cargo.
Definition saveload.h:95
@ NewGRFStations
Saveload version: 27, SVN revision: 4757 NewGRF graphics for stations.
Definition saveload.h:79
@ FixRoadOwnership
Saveload version: 173, SVN revision: 23967, release: 1.2.0-RC1 Seemingly unneeded bump supposed to f...
Definition saveload.h:254
@ StartPatchpacks
Saveload version: 220 First known patchpack to use a version just above ours.
Definition saveload.h:324
@ ExtendPersistentStorage
Saveload version: 201, GitHub pull request: 6885 Extend NewGRF persistent storages.
Definition saveload.h:288
@ NoAI
Saveload version: 107, SVN revision: 15027 Replace built in cheating AI with framework for externall...
Definition saveload.h:175
@ LocksUnderBridges
Saveload version: 361, GitHub pull request: 14595 Allow locks under bridges.
Definition saveload.h:416
@ ScriptTownText
Saveload version: 168, SVN revision: 23637 Game scripts can put a text in the town window.
Definition saveload.h:248
@ UnifyWaterClass
Saveload version: 146, SVN revision: 20446 Unify location for storing water class in the map.
Definition saveload.h:222
@ Cities
Saveload version: 56, SVN revision: 9667 Cities that start bigger and grow faster.
Definition saveload.h:114
@ AirportNoise
Saveload version: 96, SVN revision: 13226 Introduce noise for airports, to allow more than two airpo...
Definition saveload.h:162
@ CargoPaymentOverflow
Saveload version: 70, SVN revision: 10541 Fix overflow of cargo payment rates, plus preparation for ...
Definition saveload.h:131
@ RiffToArray
Saveload version: 294, GitHub pull request: 9375 Changed many ChunkType::Riff chunks to ChunkType::A...
Definition saveload.h:335
@ FixOrderBackup
Saveload version: 192, SVN revision: 26700 Fix saving of order backups.
Definition saveload.h:277
@ BridgeWormhole
Saveload version: 42, SVN revision: 7573 Bridges become wormholes, so more things can be built under...
Definition saveload.h:97
@ TramLivery
Saveload version: 63, SVN revision: 9956 Add separate livery for trams.
Definition saveload.h:122
@ GSIndustryControl
Saveload version: 287, GitHub pull request: 7912 and 8115 GS industry control.
Definition saveload.h:327
@ LinkFarmFieldToIndustry
Saveload version: 32, SVN revision: 6001 Link farm fields to the industry, so it gets removed when t...
Definition saveload.h:85
@ ConsistentPartialZ
Saveload version: 306, GitHub pull request: 10570 Conversion from an inconsistent partial Z calculat...
Definition saveload.h:350
@ ScriptSettingsProfile
Saveload version: 178, SVN revision: 24789 Setting for the difficulty profile of AIs.
Definition saveload.h:260
@ HideEnginesForCompany
Saveload version: 193, SVN revision: 26802 Hiding of engines for a company.
Definition saveload.h:278
constexpr size_t SlVarSize(VarMemType type)
Return expect size in bytes of a VarType.
Definition saveload.h:796
std::vector< SaveLoad > SlTableHeader(const SaveLoadTable &slt)
Save or Load a table header.
bool IsSavegameVersionBeforeOrAt(SaveLoadVersion major)
Checks whether the savegame is below or at major.
Definition saveload.h:1272
void SlGlobList(const SaveLoadTable &slt)
Save or Load (a list of) global variables.
ChunkType
Type of a chunk.
Definition saveload.h:441
@ SparseTable
A SparseArray with a header describing the elements.
Definition saveload.h:446
@ ReadOnly
Chunk is never saved.
Definition saveload.h:449
@ Table
An Array with a header describing the elements.
Definition saveload.h:445
@ FileTypeMask
All ChunkType values that are saved in the file have to be within this mask.
Definition saveload.h:448
@ Riff
4 bits store the chunk type, 28 bits the number of bytes.
Definition saveload.h:442
@ SparseArray
Array of elements with index for each element.
Definition saveload.h:444
int64_t ReadValue(const void *ptr, VarMemType conv)
Return a signed-long version of the value of a setting.
Definition saveload.cpp:885
void SlAutolength(AutolengthProc *proc, int arg)
Do something of which I have no idea what it is :P.
void SlReadString(std::string &str, size_t length)
Read the given amount of bytes from the buffer into the string.
void SlSetStructListLength(size_t length)
Set the length of this list.
Label< struct ChunkIdTag > ChunkId
Label/unique identifier for each of the chunks in the savegame.
Definition saveload.h:453
Functions/types related to errors from savegames.
Functions related to saving and loading games.
Types often used outside the saveload code related to saving and loading games.
std::span< const struct SaveLoad > SaveLoadTable
A table of SaveLoad entries.
std::vector< Titem, ScriptStdAllocator< Titem > > Array
Definition of a simple array.
StringValidationSetting
Settings for the string validation.
Definition string_type.h:44
EnumBitSet< StringValidationSetting, uint8_t > StringValidationSettings
Bitset of StringValidationSetting elements.
Definition string_type.h:57
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
Base for a four character label/tag/id.
Container for cargo from the same location and time.
Definition cargopacket.h:41
virtual void FixPointers() const
Fix the pointers.
Definition saveload.h:488
ChunkType type
Type of the chunk.
Definition saveload.h:458
virtual void LoadCheck(size_t len=0) const
Load the chunk for game preview.
ChunkHandler(ChunkId id, ChunkType type)
Create this ChunkHandler.
Definition saveload.h:465
ChunkId id
Unique ID (4 letters).
Definition saveload.h:457
std::string GetName() const
Get the name of this chunk.
Definition saveload.h:501
virtual void Load() const =0
Load the chunk.
virtual ~ChunkHandler()=default
Ensure the destructor of the sub classes are called as well.
virtual void Save() const
Save the chunk.
Definition saveload.h:474
Struct to store engine replacements.
A four character label/tag/id.
Shared order list linking together the linked list of orders and the list of vehicles sharing this or...
Definition order_base.h:384
A Stop for a Road Vehicle.
SaveLoad information for backwards compatibility.
Definition saveload.h:784
std::string_view name
Name of the field.
Definition saveload.h:785
SaveLoadVersion version_to
Save/load the variable before this savegame version.
Definition saveload.h:788
SaveLoadVersion version_from
Save/load the variable starting from this savegame version.
Definition saveload.h:787
uint16_t null_length
Length of the NULL field.
Definition saveload.h:786
SaveLoad type struct.
Definition saveload.h:764
uint16_t length
(Conditional) length of the variable (eg. arrays) (max array size is 65536 elements).
Definition saveload.h:768
std::shared_ptr< SaveLoadHandler > handler
Custom handler for Save/Load procs.
Definition saveload.h:773
SaveLoadAddrProc * address_proc
Callback proc the get the actual variable address in memory.
Definition saveload.h:771
SaveLoadVersion version_to
Save/load the variable before this savegame version.
Definition saveload.h:770
SaveLoadType cmd
The action to take with the saved/loaded type, All types need different action.
Definition saveload.h:766
std::string name
Name of this field (optional, used for tables).
Definition saveload.h:765
VarType conv
Type of the variable to be saved; this field combines both FileVarType and MemVarType.
Definition saveload.h:767
size_t extra_data
Extra data for the callback proc.
Definition saveload.h:772
SaveLoadVersion version_from
Save/load the variable starting from this savegame version.
Definition saveload.h:769
Station data structure.
Town data structure.
Definition town.h:64
Container of a variable's characteristics about a variable's storage.
Definition saveload.h:670
constexpr VarType()
Create an empty VarType.
Definition saveload.h:677
SLRefType ref
The reference type.
Definition saveload.h:674
VarMemType mem
The way of storing data in memory.
Definition saveload.h:672
StringValidationSettings string_validation_settings
Any settings related to validation of the strings.
Definition saveload.h:673
constexpr bool operator==(const VarType &other) const =default
Equality operator.
VarFileType file
The way of storing data in the file.
Definition saveload.h:671
constexpr VarType operator|(StringValidationSetting string_validation_setting) const
Transitional helper function to add a SaveLoadFlag to this type.
Definition saveload.h:704
constexpr VarType(VarFileType file, VarMemType mem)
Create a VarType with the given file and memory configurations.
Definition saveload.h:684
constexpr VarType(SLRefType ref)
Create a VarType linking to a reference.
Definition saveload.h:690
Container for holding some default VarType instances.
Definition saveload.h:724
static constexpr VarType U16
Store a 16 bits unsigned int.
Definition saveload.h:729
static constexpr VarType STRQ
Store a string with quotes.
Definition saveload.h:736
static constexpr VarType U8
Store a 8 bits unsigned int.
Definition saveload.h:727
static constexpr VarType STR
Store string.
Definition saveload.h:735
static constexpr VarType LABEL_REVERSE
Store a Label in reverse.
Definition saveload.h:738
static constexpr VarType I16
Store a 16 bits signed int.
Definition saveload.h:728
static constexpr VarType NAME
A string stored in the custom string array.
Definition saveload.h:737
static constexpr VarType I64
Store a 64 bits signed int.
Definition saveload.h:732
static constexpr VarType U64
Store a 64 bits unsigned int.
Definition saveload.h:733
static constexpr VarType I8
Store a 8 bits signed int.
Definition saveload.h:726
static constexpr VarType U32
Store a 32 bits unsigned int.
Definition saveload.h:731
static constexpr VarType STRINGID
Store a StringID.
Definition saveload.h:734
static constexpr VarType LABEL_FORWARD
Store a Label as-is.
Definition saveload.h:739
static constexpr VarType I32
Store a 32 bits signed int.
Definition saveload.h:730
static constexpr VarType BOOL
Store a boolean (as int8).
Definition saveload.h:725
Vehicle data structure.
TownLayout
Town Layouts.
Definition town_type.h:83
WaterClass
classes of water (for WaterTileType::Clear water tile type).
Definition water_map.h:39
WaterTileType
Available water tile types.
Definition water_map.h:31