OpenTTD Source 20260711-master-g3fb3006dff
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_error.hpp"
14#include "../fileio_type.h"
15#include "../fios.h"
16
30enum class SaveLoadVersion : uint16_t {
32
43
52
59
67
73
79
85
91
97
103
109
115
121
127
133
139
145
151
157
163
169
175
181
187
193
199
205
211
217
223
229
235
237 PersistentStoragePool,
241
247
253
259
265
271
277
283
287 ShipPathCache,
289
295
301
307
308 /* Patchpacks for a while considered it a good idea to jump a few versions
309 * above our version for their savegames. But as time continued, this gap
310 * has been closing, up to the point we would start to reuse versions from
311 * their patchpacks. This is not a problem from our perspective: the
312 * savegame will simply fail to load because they all contain chunks we
313 * cannot digest. But, this gives for ugly errors. As we have plenty of
314 * versions anyway, we simply skip the versions we know belong to
315 * patchpacks. This way we can present the user with a clean error
316 * indicate they are loading a savegame from a patchpack.
317 * For future patchpack creators: please follow a system like JGRPP, where
318 * the version is masked with 0x8000, and the true version is stored in
319 * its own chunk with feature toggles.
320 */
323
327
333
339
345
351
357
363
369
375
381
387
393
399
405
411
417
420
422};
423
425enum class SaveLoadResult : uint8_t {
429};
430
441
451
453
454std::string GenerateDefaultSaveName();
455void SetSaveLoadError(StringID str);
458SaveLoadResult SaveOrLoad(std::string_view filename, SaveLoadOperation fop, DetailedFileType dft, Subdirectory sb, bool threaded = true);
459void WaitTillSaved();
461void DoExitSave();
462
464
465SaveLoadResult SaveWithFilter(std::shared_ptr<struct SaveFilter> writer, bool threaded);
466SaveLoadResult LoadWithFilter(std::shared_ptr<struct LoadFilter> reader);
467
468typedef void AutolengthProc(int);
469
471enum class ChunkType : uint8_t {
472 Riff = 0,
473 Array = 1,
475 Table = 3,
477
480};
481
483struct ChunkHandler {
484 uint32_t id;
486
487 ChunkHandler(uint32_t id, ChunkType type) : id(id), type(type) {}
488
490 virtual ~ChunkHandler() = default;
491
496 virtual void Save() const { NOT_REACHED(); }
497
502 virtual void Load() const = 0;
503
510 virtual void FixPointers() const {}
511
517 virtual void LoadCheck(size_t len = 0) const;
518
519 std::string GetName() const
520 {
521 return std::string()
522 + static_cast<char>(this->id >> 24)
523 + static_cast<char>(this->id >> 16)
524 + static_cast<char>(this->id >> 8)
525 + static_cast<char>(this->id);
526 }
527};
528
530using ChunkHandlerRef = std::reference_wrapper<const ChunkHandler>;
531
533using ChunkHandlerTable = std::span<const ChunkHandlerRef>;
534
536using SaveLoadTable = std::span<const struct SaveLoad>;
537
539using SaveLoadCompatTable = std::span<const struct SaveLoadCompat>;
540
543public:
544 std::optional<std::vector<SaveLoad>> load_description;
545
547 virtual ~SaveLoadHandler() = default;
548
553 virtual void Save([[maybe_unused]] void *object) const {}
554
559 virtual void Load([[maybe_unused]] void *object) const {}
560
565 virtual void LoadCheck([[maybe_unused]] void *object) const {}
566
571 virtual void FixPointers([[maybe_unused]] void *object) const {}
572
577 virtual SaveLoadTable GetDescription() const = 0;
578
584
592};
593
605template <class TImpl, class TObject>
607public:
608 SaveLoadTable GetDescription() const override { return static_cast<const TImpl *>(this)->description; }
609
610 SaveLoadCompatTable GetCompatDescription() const override { return static_cast<const TImpl *>(this)->compat_description; }
611
616 virtual void Save([[maybe_unused]] TObject *object) const {}
617 void Save(void *object) const override { this->Save(static_cast<TObject *>(object)); }
618
623 virtual void Load([[maybe_unused]] TObject *object) const {}
624 void Load(void *object) const override { this->Load(static_cast<TObject *>(object)); }
625
630 virtual void LoadCheck([[maybe_unused]] TObject *object) const {}
631 void LoadCheck(void *object) const override { this->LoadCheck(static_cast<TObject *>(object)); }
632
637 virtual void FixPointers([[maybe_unused]] TObject *object) const {}
638 void FixPointers(void *object) const override { this->FixPointers(static_cast<TObject *>(object)); }
639};
640
655
657enum class VarFileType : uint8_t {
658 /* 4 bits allocated a maximum of 16 types for NumberType.
659 * NOTE: the SLE_FILE_NNN values are stored in the savegame! */
660 /* Value 0 is used to mark end-of-header in tables. Do not use here! */
661 I8 = 1,
662 U8 = 2,
663 I16 = 3,
664 U16 = 4,
665 I32 = 5,
666 U32 = 6,
667 I64 = 7,
668 U64 = 8,
670 String = 10,
671 Struct = 11,
672 /* 4 more possible file-primitives */
673};
674
676enum class VarMemType : uint8_t {
677 /* 4 bits allocated a maximum of 16 types for NumberType */
678 Bool = 0,
679 I8 = 1,
680 U8 = 2,
681 I16 = 3,
682 U16 = 4,
683 I32 = 5,
684 U32 = 6,
685 I64 = 7,
686 U64 = 8,
687 Null = 9,
688 Str = 12,
689 StrQ = 13,
690 Name = 14,
691 /* 1 more possible memory-primitives */
692};
693
695struct VarType {
700
702 constexpr VarType() {}
703
710
715 constexpr VarType(SLRefType ref) : ref(ref) {}
716
722 constexpr bool operator==(const VarType &other) const = default;
723
729 constexpr VarType operator|(StringValidationSetting string_validation_setting) const
730 {
731 VarType copy = *this;
732 copy.string_validation_settings.Set(string_validation_setting);
733 return copy;
734 }
735};
736
744{
745 return {file, mem};
746}
747
764
766enum class SaveLoadType : uint8_t {
769 Struct = 2,
770
771 String = 4,
772
773 Array = 5,
774 Vector = 7,
777
778 SaveByte = 10,
779 Null = 11,
780
782};
783
784typedef void *SaveLoadAddrProc(void *base, size_t extra);
785
787struct SaveLoad {
788 std::string name;
791 uint16_t length;
794 SaveLoadAddrProc *address_proc;
795 size_t extra_data;
796 std::shared_ptr<SaveLoadHandler> handler;
797};
798
813
819inline constexpr size_t SlVarSize(VarMemType type)
820{
821 switch (type) {
822 case VarMemType::Bool: return sizeof(bool);
823 case VarMemType::I8: return sizeof(int8_t);
824 case VarMemType::U8: return sizeof(uint8_t);
825 case VarMemType::I16: return sizeof(int16_t);
826 case VarMemType::U16: return sizeof(uint16_t);
827 case VarMemType::I32: return sizeof(int32_t);
828 case VarMemType::U32: return sizeof(uint32_t);
829 case VarMemType::I64: return sizeof(int64_t);
830 case VarMemType::U64: return sizeof(uint64_t);
831 case VarMemType::Null: return sizeof(void *);
832 case VarMemType::Str: return sizeof(std::string);
833 case VarMemType::StrQ: return sizeof(std::string);
834 case VarMemType::Name: return sizeof(std::string);
835 default: NOT_REACHED();
836 }
837}
838
847inline constexpr bool SlCheckVarSize(SaveLoadType cmd, VarType type, size_t length, size_t size)
848{
849 switch (cmd) {
850 case SaveLoadType::Variable: return SlVarSize(type.mem) == size;
851 case SaveLoadType::Reference: return sizeof(void *) == size;
852 case SaveLoadType::String: return SlVarSize(type.mem) == size;
853 case SaveLoadType::Array: return SlVarSize(type.mem) * length <= size; // Partial load of array is permitted.
854 case SaveLoadType::Vector: return sizeof(std::vector<void *>) == size;
855 case SaveLoadType::ReferenceList: return sizeof(std::list<void *>) == size;
856 case SaveLoadType::ReferenceVector: return sizeof(std::vector<void *>) == size;
857 case SaveLoadType::SaveByte: return true;
858 default: NOT_REACHED();
859 }
860}
861
875#define SLE_GENERAL_NAME(cmd, name, base, variable, type, length, from, to, extra) \
876 SaveLoad {name, cmd, type, length, from, to, [] (void *b, size_t) -> void * { \
877 static_assert(SlCheckVarSize(cmd, type, length, sizeof(static_cast<base *>(b)->variable))); \
878 assert(b != nullptr); \
879 return const_cast<void *>(static_cast<const void *>(std::addressof(static_cast<base *>(b)->variable))); \
880 }, extra, nullptr}
881
894#define SLE_GENERAL(cmd, base, variable, type, length, from, to, extra) SLE_GENERAL_NAME(cmd, #variable, base, variable, type, length, from, to, extra)
895
904#define SLE_CONDVAR(base, variable, type, from, to) SLE_GENERAL(SaveLoadType::Variable, base, variable, type, 0, from, to, 0)
905
915#define SLE_CONDVARNAME(base, variable, name, type, from, to) SLE_GENERAL_NAME(SaveLoadType::Variable, name, base, variable, type, 0, from, to, 0)
916
925#define SLE_CONDREF(base, variable, type, from, to) SLE_GENERAL(SaveLoadType::Reference, base, variable, type, 0, from, to, 0)
926
936#define SLE_CONDARR(base, variable, type, length, from, to) SLE_GENERAL(SaveLoadType::Array, base, variable, type, length, from, to, 0)
937
948#define SLE_CONDARRNAME(base, variable, name, type, length, from, to) SLE_GENERAL_NAME(SaveLoadType::Array, name, base, variable, type, length, from, to, 0)
949
958#define SLE_CONDSSTR(base, variable, type, from, to) SLE_GENERAL(SaveLoadType::String, base, variable, type, 0, from, to, 0)
959
969#define SLE_CONDSSTRNAME(base, variable, name, type, from, to) SLE_GENERAL_NAME(SaveLoadType::String, name, base, variable, type, 0, from, to, 0)
970
979#define SLE_CONDREFLIST(base, variable, type, from, to) SLE_GENERAL(SaveLoadType::ReferenceList, base, variable, type, 0, from, to, 0)
980
989#define SLE_CONDREFVECTOR(base, variable, type, from, to) SLE_GENERAL(SaveLoadType::ReferenceVector, base, variable, type, 0, from, to, 0)
990
999#define SLE_CONDVECTOR(base, variable, type, from, to) SLE_GENERAL(SaveLoadType::Vector, base, variable, type, 0, from, to, 0)
1000
1009#define SLE_CONDVECTOR(base, variable, type, from, to) SLE_GENERAL(SaveLoadType::Vector, base, variable, type, 0, from, to, 0)
1010
1017#define SLE_VAR(base, variable, type) SLE_CONDVAR(base, variable, type, SaveLoadVersion::MinVersion, SaveLoadVersion::MaxVersion)
1018
1026#define SLE_VARNAME(base, variable, name, type) SLE_CONDVARNAME(base, variable, name, type, SaveLoadVersion::MinVersion, SaveLoadVersion::MaxVersion)
1027
1034#define SLE_REF(base, variable, type) SLE_CONDREF(base, variable, type, SaveLoadVersion::MinVersion, SaveLoadVersion::MaxVersion)
1035
1043#define SLE_ARR(base, variable, type, length) SLE_CONDARR(base, variable, type, length, SaveLoadVersion::MinVersion, SaveLoadVersion::MaxVersion)
1044
1053#define SLE_ARRNAME(base, variable, name, type, length) SLE_CONDARRNAME(base, variable, name, type, length, SaveLoadVersion::MinVersion, SaveLoadVersion::MaxVersion)
1054
1061#define SLE_SSTR(base, variable, type) SLE_CONDSSTR(base, variable, type, SaveLoadVersion::MinVersion, SaveLoadVersion::MaxVersion)
1062
1070#define SLE_SSTRNAME(base, variable, name, type) SLE_CONDSSTRNAME(base, variable, name, type, SaveLoadVersion::MinVersion, SaveLoadVersion::MaxVersion)
1071
1078#define SLE_REFLIST(base, variable, type) SLE_CONDREFLIST(base, variable, type, SaveLoadVersion::MinVersion, SaveLoadVersion::MaxVersion)
1079
1086#define SLE_REFVECTOR(base, variable, type) SLE_CONDREFVECTOR(base, variable, type, SaveLoadVersion::MinVersion, SaveLoadVersion::MaxVersion)
1087
1098#define SLE_SAVEBYTE(base, variable) SLE_GENERAL(SaveLoadType::SaveByte, base, variable, {}, 0, SaveLoadVersion::MinVersion, SaveLoadVersion::MaxVersion, 0)
1099
1111#define SLEG_GENERAL(name, cmd, variable, type, length, from, to, extra) \
1112 SaveLoad {name, cmd, type, length, from, to, [] (void *, size_t) -> void * { \
1113 static_assert(SlCheckVarSize(cmd, type, length, sizeof(variable))); \
1114 return static_cast<void *>(std::addressof(variable)); }, extra, nullptr}
1115
1124#define SLEG_CONDVAR(name, variable, type, from, to) SLEG_GENERAL(name, SaveLoadType::Variable, variable, type, 0, from, to, 0)
1125
1134#define SLEG_CONDREF(name, variable, type, from, to) SLEG_GENERAL(name, SaveLoadType::Reference, variable, type, 0, from, to, 0)
1135
1145#define SLEG_CONDARR(name, variable, type, length, from, to) SLEG_GENERAL(name, SaveLoadType::Array, variable, type, length, from, to, 0)
1146
1155#define SLEG_CONDSSTR(name, variable, type, from, to) SLEG_GENERAL(name, SaveLoadType::String, variable, type, 0, from, to, 0)
1156
1164#define SLEG_CONDSTRUCT(name, handler, from, to) SaveLoad {name, SaveLoadType::Struct, {}, 0, from, to, nullptr, 0, std::make_shared<handler>()}
1165
1174#define SLEG_CONDREFLIST(name, variable, type, from, to) SLEG_GENERAL(name, SaveLoadType::ReferenceList, variable, type, 0, from, to, 0)
1175
1184#define SLEG_CONDVECTOR(name, variable, type, from, to) SLEG_GENERAL(name, SaveLoadType::Vector, variable, type, 0, from, to, 0)
1185
1193#define SLEG_CONDSTRUCTLIST(name, handler, from, to) SaveLoad {name, SaveLoadType::StructList, {}, 0, from, to, nullptr, 0, std::make_shared<handler>()}
1194
1201#define SLEG_VAR(name, variable, type) SLEG_CONDVAR(name, variable, type, SaveLoadVersion::MinVersion, SaveLoadVersion::MaxVersion)
1202
1209#define SLEG_REF(name, variable, type) SLEG_CONDREF(name, variable, type, SaveLoadVersion::MinVersion, SaveLoadVersion::MaxVersion)
1210
1218#define SLEG_ARR(name, variable, type, length) SLEG_CONDARR(name, variable, type, length, SaveLoadVersion::MinVersion, SaveLoadVersion::MaxVersion)
1219
1226#define SLEG_SSTR(name, variable, type) SLEG_CONDSSTR(name, variable, type, SaveLoadVersion::MinVersion, SaveLoadVersion::MaxVersion)
1227
1233#define SLEG_STRUCT(name, handler) SLEG_CONDSTRUCT(name, handler, SaveLoadVersion::MinVersion, SaveLoadVersion::MaxVersion)
1234
1241#define SLEG_REFLIST(name, variable, type) SLEG_CONDREFLIST(name, variable, type, SaveLoadVersion::MinVersion, SaveLoadVersion::MaxVersion)
1242
1249#define SLEG_VECTOR(name, variable, type) SLEG_CONDVECTOR(name, variable, type, SaveLoadVersion::MinVersion, SaveLoadVersion::MaxVersion)
1250
1256#define SLEG_STRUCTLIST(name, handler) SLEG_CONDSTRUCTLIST(name, handler, SaveLoadVersion::MinVersion, SaveLoadVersion::MaxVersion)
1257
1262#define SLC_VAR(name) {name, 0, SaveLoadVersion::MinVersion, SaveLoadVersion::MaxVersion}
1263
1270#define SLC_NULL(length, from, to) {{}, length, from, to}
1271
1278inline bool IsSavegameVersionBefore(SaveLoadVersion major, uint8_t minor = 0)
1279{
1281 extern uint8_t _sl_minor_version;
1282 return _sl_version < major || (minor > 0 && _sl_version == major && _sl_minor_version < minor);
1283}
1284
1293{
1295 return _sl_version <= major;
1296}
1297
1305inline bool SlIsObjectCurrentlyValid(SaveLoadVersion version_from, SaveLoadVersion version_to)
1306{
1307 extern const SaveLoadVersion SAVEGAME_VERSION;
1308 return version_from <= SAVEGAME_VERSION && SAVEGAME_VERSION < version_to;
1309}
1310
1319inline void *GetVariableAddress(const void *object, const SaveLoad &sld)
1320{
1321 /* Entry is a null-variable, mostly used to read old savegames etc. */
1322 if (sld.conv.mem == VarMemType::Null) {
1323 assert(sld.address_proc == nullptr);
1324 return nullptr;
1325 }
1326
1327 /* Everything else should be a non-null pointer. */
1328 assert(sld.address_proc != nullptr);
1329 return sld.address_proc(const_cast<void *>(object), sld.extra_data);
1330}
1331
1332int64_t ReadValue(const void *ptr, VarMemType conv);
1333void WriteValue(void *ptr, VarMemType conv, int64_t val);
1334
1335void SlSetArrayIndex(uint index);
1336static void SlSetArrayIndex(const ConvertibleThroughBase auto &index) { SlSetArrayIndex(index.base()); }
1337int SlIterateArray();
1338
1339void SlSetStructListLength(size_t length);
1340size_t SlGetStructListLength(size_t limit);
1341
1342void SlAutolength(AutolengthProc *proc, int arg);
1343size_t SlGetFieldLength();
1344void SlSetLength(size_t length);
1345size_t SlCalcObjMemberLength(const void *object, const SaveLoad &sld);
1346size_t SlCalcObjLength(const void *object, const SaveLoadTable &slt);
1347
1348uint8_t SlReadByte();
1349void SlReadString(std::string &str, size_t length);
1350void SlWriteByte(uint8_t b);
1351
1352void SlGlobList(const SaveLoadTable &slt);
1353void SlCopy(void *object, size_t length, VarType conv);
1354std::vector<SaveLoad> SlTableHeader(const SaveLoadTable &slt);
1355std::vector<SaveLoad> SlCompatTableHeader(const SaveLoadTable &slt, const SaveLoadCompatTable &slct);
1356void SlObject(void *object, const SaveLoadTable &slt);
1357
1359
1365inline void SlSkipBytes(size_t length)
1366{
1367 for (; length != 0; length--) SlReadByte();
1368}
1369
1370extern std::string _savegame_format;
1371extern bool _do_autosave;
1372
1384template <class TImpl, class TObject, class TElementType, size_t MAX_LENGTH = UINT32_MAX>
1385class VectorSaveLoadHandler : public DefaultSaveLoadHandler<TImpl, TObject> {
1386public:
1392 virtual std::vector<TElementType> &GetVector(TObject *object) const = 0;
1393
1399 virtual size_t GetLength() const { return SlGetStructListLength(MAX_LENGTH); }
1400
1401 void Save(TObject *object) const override
1402 {
1403 auto &vector = this->GetVector(object);
1404 SlSetStructListLength(vector.size());
1405
1406 for (auto &item : vector) {
1407 SlObject(&item, this->GetDescription());
1408 }
1409 }
1410
1411 void Load(TObject *object) const override
1412 {
1413 auto &vector = this->GetVector(object);
1414 size_t count = this->GetLength();
1415
1416 vector.reserve(count);
1417 while (count-- > 0) {
1418 auto &item = vector.emplace_back();
1419 SlObject(&item, this->GetLoadDescription());
1420 }
1421 }
1422};
1423
1424#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:606
void FixPointers(void *object) const override
A post-load callback to fix SaveLoadType::Reference integers into pointers.
Definition saveload.h:638
virtual void Load(TObject *object) const
Load the object from disk.
Definition saveload.h:623
void Save(void *object) const override
Save the object to disk.
Definition saveload.h:617
virtual void FixPointers(TObject *object) const
A post-load callback to fix SaveLoadType::Reference integers into pointers.
Definition saveload.h:637
SaveLoadTable GetDescription() const override
Get the description of the fields in the savegame.
Definition saveload.h:608
void LoadCheck(void *object) const override
Similar to load, but used only to validate savegames.
Definition saveload.h:631
SaveLoadCompatTable GetCompatDescription() const override
Get the pre-header description of the fields in the savegame.
Definition saveload.h:610
virtual void LoadCheck(TObject *object) const
Similar to load, but used only to validate savegames.
Definition saveload.h:630
void Load(void *object) const override
Load the object from disk.
Definition saveload.h:624
virtual void Save(TObject *object) const
Save the object to disk.
Definition saveload.h:616
Container for an encoded string, created by GetEncodedString.
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:542
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:559
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:544
virtual void FixPointers(void *object) const
A post-load callback to fix SaveLoadType::Reference integers into pointers.
Definition saveload.h:571
virtual void Save(void *object) const
Save the object to disk.
Definition saveload.h:553
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:565
Default handler for saving/loading a vector to/from disk.
Definition saveload.h:1385
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:1411
void Save(TObject *object) const override
Save the object to disk.
Definition saveload.h:1401
virtual size_t GetLength() const
Get number of elements to load into vector.
Definition saveload.h:1399
A type is considered 'convertible through base()' when it has a 'base()' function that returns someth...
Types for standard in/out file operations.
SaveLoadOperation
Operation performed on the file.
Definition fileio_type.h:52
@ Load
File is being loaded.
Definition fileio_type.h:54
DetailedFileType
Kinds of files in each AbstractFileType.
Definition fileio_type.h:28
Subdirectory
The different kinds of subdirectories OpenTTD uses.
Definition fileio_type.h:88
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
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:32
std::string _savegame_format
how to compress savegames
Definition saveload.cpp:83
bool _do_autosave
are we doing an autosave at the moment?
Definition saveload.cpp:84
SaveLoadResult SaveWithFilter(std::shared_ptr< SaveFilter > writer, bool threaded)
Save the game using a (writer) filter.
FileToSaveLoad _file_to_saveload
File to save or load in the openttd loop.
Definition saveload.cpp:78
SaveLoadResult LoadWithFilter(std::shared_ptr< LoadFilter > reader)
Load the game using a (reader) filter.
VarMemType
The types/structures of data we have in memory.
Definition saveload.h:676
@ U64
A 64 bit unsigned int.
Definition saveload.h:686
@ Name
old custom name to be converted to a string pointer
Definition saveload.h:690
@ I8
A 8 bit signed int.
Definition saveload.h:679
@ U8
A 8 bit unsigned int.
Definition saveload.h:680
@ StrQ
string pointer enclosed in quotes
Definition saveload.h:689
@ Null
useful to write zeros in savegame.
Definition saveload.h:687
@ I16
A 16 bit signed int.
Definition saveload.h:681
@ Bool
A boolean value.
Definition saveload.h:678
@ U32
A 32 bit unsigned int.
Definition saveload.h:684
@ I32
A 32 bit signed int.
Definition saveload.h:683
@ I64
A 64 bit signed int.
Definition saveload.h:685
@ Str
string pointer
Definition saveload.h:688
@ U16
A 16 bit unsigned int.
Definition saveload.h:682
void ProcessAsyncSaveFinish()
Handle async save finishes.
Definition saveload.cpp:394
VarFileType
The types/structures of data that can be stored in the file.
Definition saveload.h:657
@ String
A string.
Definition saveload.h:670
@ U64
A 64 bit unsigned int.
Definition saveload.h:668
@ I8
A 8 bit signed int.
Definition saveload.h:661
@ U8
A 8 bit unsigned int.
Definition saveload.h:662
@ Struct
An arbitrary structure.
Definition saveload.h:671
@ I16
A 16 bit signed int.
Definition saveload.h:663
@ U32
A 32 bit unsigned int.
Definition saveload.h:666
@ StringID
StringID offset into strings-array.
Definition saveload.h:669
@ I32
A 32 bit signed int.
Definition saveload.h:665
@ I64
A 64 bit signed int.
Definition saveload.h:667
@ U16
A 16 bit unsigned int.
Definition saveload.h:664
constexpr VarType operator|(VarFileType file, VarMemType mem)
Transitional helper function to combine a file and memory storage configuration.
Definition saveload.h:743
SavegameType
Types of save games.
Definition saveload.h:443
@ TTDP1
TTDP savegame ( -//- ) (data at NW border).
Definition saveload.h:445
@ TTO
TTO savegame.
Definition saveload.h:448
@ TTD
TTD savegame (can be detected incorrectly).
Definition saveload.h:444
@ TTDP2
TTDP savegame in new format (data at SE border).
Definition saveload.h:446
@ Invalid
broken savegame (used internally)
Definition saveload.h:449
@ OTTD
OTTD savegame.
Definition saveload.h:447
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:734
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:1365
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:860
void DoAutoOrNetsave(FiosNumberedSaveName &counter)
Create an autosave or netsave.
std::reference_wrapper< const ChunkHandler > ChunkHandlerRef
A reference to ChunkHandler.
Definition saveload.h:530
SLRefType
Type of reference (SLE_REF, SLE_CONDREF).
Definition saveload.h:642
@ OldVehicle
Load/save an old-style reference to a vehicle (for pre-4.4 savegames).
Definition saveload.h:646
@ Storage
Load/save a reference to a persistent storage.
Definition saveload.h:651
void * GetVariableAddress(const void *object, const SaveLoad &sld)
Get the address of the variable.
Definition saveload.h:1319
EncodedString GetSaveLoadErrorType()
Return the appropriate initial string for an error depending on whether we are saving or loading.
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:847
std::span< const ChunkHandlerRef > ChunkHandlerTable
A table of ChunkHandler entries.
Definition saveload.h:533
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:1305
SaveLoadType
Type of data saved.
Definition saveload.h:766
@ ReferenceList
Save/load a list of SaveLoadType::Reference elements.
Definition saveload.h:775
@ String
Save/load a std::string.
Definition saveload.h:771
@ Array
Save/load a fixed-size array of SaveLoadType::Variable elements.
Definition saveload.h:773
@ Variable
Save/load a variable.
Definition saveload.h:767
@ Vector
Save/load a vector of SaveLoadType::Variable elements.
Definition saveload.h:774
@ Reference
Save/load a reference.
Definition saveload.h:768
@ StructList
Save/load a list of structs.
Definition saveload.h:776
@ SaveByte
Save (but not load) a byte.
Definition saveload.h:778
@ ReferenceVector
Save/load a vector of SaveLoadType::Reference elements.
Definition saveload.h:781
SaveLoadResult SaveOrLoad(std::string_view filename, SaveLoadOperation fop, DetailedFileType dft, Subdirectory sb, bool threaded=true)
Main Save or Load function where the high-level saveload functions are handled.
bool SaveloadCrashWithMissingNewGRFs()
Did loading the savegame cause a crash?
void WriteValue(void *ptr, VarMemType conv, int64_t val)
Write the value of a setting.
Definition saveload.cpp:896
std::span< const struct SaveLoadCompat > SaveLoadCompatTable
A table of SaveLoadCompat entries.
Definition saveload.h:539
void SlSetLength(size_t length)
Sets the length of either a RIFF object or the number of items in an array.
Definition saveload.cpp:788
uint8_t SlReadByte()
Wrapper for reading a byte from the buffer.
Definition saveload.cpp:410
void DoExitSave()
Do a save when exiting the game (_settings_client.gui.autosave_on_exit).
bool IsSavegameVersionBefore(SaveLoadVersion major, uint8_t minor=0)
Checks whether the savegame is below major.
Definition saveload.h:1278
SaveLoadResult
Save or load result codes.
Definition saveload.h:425
@ Error
error that was caught before internal structures were modified
Definition saveload.h:427
@ Ok
completed successfully
Definition saveload.h:426
@ ReInit
error that was caught in the middle of updating game state, need to clear it. (can only happen during...
Definition saveload.h:428
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:30
@ LastLoadingTick
Saveload version: 301, GitHub pull request: 9693 Store tick of last loading for vehicles.
Definition saveload.h:341
@ LargerTownCargoStatistics
Saveload version: 9.0, SVN revision: 1909 Increase size of passenger/mail production of this and pre...
Definition saveload.h:51
@ BigDates
Saveload version: 31, SVN revision: 5999 Change date from 1920 - 2090 to 0 - 5 000 000.
Definition saveload.h:81
@ IncreaseHouseLimit
Saveload version: 348, GitHub pull request: 12288 Increase house limit to 4096.
Definition saveload.h:397
@ BackupOrderState
Saveload version: 176, SVN revision: 24446 Put more of the state of a vehicle's orders (like latenes...
Definition saveload.h:255
@ CargoTravelled
Saveload version: 319, GitHub pull request: 11283 CargoPacket now tracks how far it travelled inside...
Definition saveload.h:362
@ CustomSeaLevel
Saveload version: 149, SVN revision: 20832 Setting to influence the sea level (amount of water).
Definition saveload.h:222
@ StoreIndustryCargo
Saveload version: 78, SVN revision: 11176 Store an industry's cargo, so it can be customised upon bu...
Definition saveload.h:137
@ StationRatingCheat
Saveload version: 320, GitHub pull request: 11346 Add cheat to fix station ratings at 100%.
Definition saveload.h:364
@ MoreEngineTypes
Saveload version: 95, SVN revision: 12924 Allow more than the original 255 engine types.
Definition saveload.h:158
@ OrdersOwnedByOrderlist
Saveload version: 354, GitHub pull request: 13948 Orders stored in OrderList, pool removed.
Definition saveload.h:404
@ ExtendCargotypes
Saveload version: 199, GitHub pull request: 6802 Extend cargotypes to 64.
Definition saveload.h:282
@ TrainSlopeSteepness
Saveload version: 133, SVN revision: 18674 Setting to increase steepness of slopes for trains under ...
Definition saveload.h:203
@ FractionProfitRunningTicks
Saveload version: 88, SVN revision: 12134 Store vehicle profits as a (fixed point) fraction,...
Definition saveload.h:149
@ UnifyWaypointAndStation
Saveload version: 123, SVN revision: 16909 Unify stations and waypoints.
Definition saveload.h:191
@ InfrastructureMaintenanceCosts
Saveload version: 166, SVN revision: 23415 Infrastructure can now cost some periodic fee.
Definition saveload.h:243
@ VehicleEconomyAge
Saveload version: 334, GitHub pull request: 12141, release: 14.0 Add vehicle age in economy year,...
Definition saveload.h:380
@ GroupReplaceWagonRemoval
Saveload version: 291, GitHub pull request: 7441 Per-group wagon removal flag.
Definition saveload.h:329
@ ImproveMultistop
Saveload version: 25, SVN revision: 4259 Improve the behaviour of RVs going to road stops.
Definition saveload.h:74
@ MonthlyBankruptcyCheck
Saveload version: 177, SVN revision: 24619 Check for bankruptcy on a monthly cycle.
Definition saveload.h:256
@ CompanyInauguratedPeriodV2
Saveload version: 349, GitHub pull request: 13448 Fix savegame storage for company inaugurated year ...
Definition saveload.h:398
@ DigitGroupSeparator
Saveload version: 118, SVN revision: 16129 Configurable digit group separator.
Definition saveload.h:185
@ GoalProgressPlaneAcceleration
Saveload version: 182, SVN revision: 25115, r25259, r25296 Goal status and plane acceleration fixes.
Definition saveload.h:262
@ BigCurrency
Saveload version: 1.0, releases: 0.1.x, 0.2.x Change currency from 32 to 64 bits.
Definition saveload.h:33
@ LiveryRefit
Saveload version: 35, SVN revision: 6602 NewGRF livery refits.
Definition saveload.h:86
@ MergeOptsPats
Saveload version: 97, SVN revision: 13256 Merge the OPTS and PATS chunks, i.e. all settings in one c...
Definition saveload.h:160
@ StringGamelog
Saveload version: 314, GitHub pull request: 10801 Use std::string in gamelog.
Definition saveload.h:356
@ GroupHierarchy
Saveload version: 189, SVN revision: 26450 Hierarchical vehicle subgroups.
Definition saveload.h:270
@ CountPaidForCargo
Saveload version: 45, SVN revision: 8501 Count the amount of cargo that was paid for.
Definition saveload.h:98
@ UnifyCurrency
Saveload version: 65, SVN revision: 10210 Make all variables related to currency 64 bits.
Definition saveload.h:122
@ DisasterVehState
Saveload version: 312, GitHub pull request: 10798 Explicit storage of disaster vehicle state.
Definition saveload.h:354
@ EndingYear
Saveload version: 218, GitHub pull request: 7747, release: 1.10 Configurable ending year.
Definition saveload.h:305
@ LinkgraphRestrictedFlow
Saveload version: 187, SVN revision: 25899 Linkgraph - restricted flows.
Definition saveload.h:268
@ FreightWeight
Saveload version: 39, SVN revision: 7269 Setting to increase the weight of cargo on freight trains.
Definition saveload.h:90
@ FifoLoading
Saveload version: 57, SVN revision: 9691 First-in-first-out loading of vehicles.
Definition saveload.h:112
@ LargerTownIterator
Saveload version: 11.0, SVN revision: 2033 Increase size of the town iterator.
Definition saveload.h:54
@ EndPatchpacks
Saveload version: 286 Last known patchpack to use a version just above ours.
Definition saveload.h:322
@ TimetableStartTicksFix
Saveload version: 322, GitHub pull request: 11557 Fix for missing convert timetable start from a dat...
Definition saveload.h:366
@ MoveSccEncoded
Saveload version: 169, SVN revision: 23816 Move SCC_ENCODED to the first StringControlCode.
Definition saveload.h:246
@ LinkgraphEdges
Saveload version: 304, GitHub pull request: 10314 Explicitly store link graph edges destination,...
Definition saveload.h:344
@ FairPlaySettings
Saveload version: 79, SVN revision: 11188 Add setting to disable exclusive rights in a town and givi...
Definition saveload.h:138
@ DockDockingtiles
Saveload version: 298, GitHub pull request: 9578 All tiles around docks may be docking tiles.
Definition saveload.h:337
@ FreeformEdges
Saveload version: 111, SVN revision: 15190 Allow terraforming along the edge of the map.
Definition saveload.h:177
@ RoadWaypoints
Saveload version: 338, GitHub pull request: 12572 Road waypoints.
Definition saveload.h:385
@ UnifyAnimationState
Saveload version: 43, SVN revision: 7642 Put all animation state information in same map bits.
Definition saveload.h:95
@ LargerUnitNumber
Saveload version: 8.0, SVN revision: 1786 Increase size of (vehicle) unit numbers.
Definition saveload.h:50
@ MoveSemaphoreBits
Saveload version: 15.0, SVN revision: 2499 Move rail signal bit for semaphores.
Definition saveload.h:60
@ ReplaceCustomNameArray
Saveload version: 84, SVN revision: 11822 Replace single fixed size array of custom names,...
Definition saveload.h:144
@ RemoveMinorVersion
Saveload version: 18, SVN revision: 3227 Remove the minor versions from savegames.
Definition saveload.h:65
@ IncreaseStationTypeFieldSize
Saveload version: 337, GitHub pull request: 12572 Increase size of StationType field in map array.
Definition saveload.h:384
@ LastVehicleType
Saveload version: 26, SVN revision: 4466 Store the last vehicle type at stations instead of the vehi...
Definition saveload.h:75
@ SavePatches
Saveload version: 22, SVN revision: 3726 Save state of patches (precursor of settings) in the savega...
Definition saveload.h:70
@ RoadLayoutPerTown
Saveload version: 113, SVN revision: 15340 Allow for different road layouts for each of the towns.
Definition saveload.h:179
@ SplitStationTypeFromGfxid
Saveload version: 72, SVN revision: 10601 Splits the encoding of station type from the graphics iden...
Definition saveload.h:130
@ NewGRFSuppliedStationName
Saveload version: 103, SVN revision: 14598 NewGRF industry supplying default names for nearby statio...
Definition saveload.h:167
@ PathCacheFormat
Saveload version: 346, GitHub pull request: 12345 Vehicle path cache format changed.
Definition saveload.h:395
@ IndustryText
Saveload version: 289, GitHub pull request: 8576, release: 1.11.0-RC1 Additional GS text for industr...
Definition saveload.h:326
@ Yapf
Saveload version: 28, SVN revision: 4987 Yet another path finder.
Definition saveload.h:77
@ MaxLengthAndReverseSignals
Saveload version: 159, SVN revision: 21962 Settings for reversing at signals, and maximum train,...
Definition saveload.h:234
@ ObjectTypeToPool
Saveload version: 186, SVN revision: 25833 Move object type from map to pool object.
Definition saveload.h:267
@ MultipleSignalTypes
Saveload version: 64, SVN revision: 10006 Multiple different signal types on the same (diagonal) til...
Definition saveload.h:120
@ PeriodsInTransitRename
Saveload version: 316, GitHub pull request: 11112 Rename days in transit to (cargo) periods in trans...
Definition saveload.h:359
@ SimplifyPlayerFace
Saveload version: 49, SVN revision: 8969 Simplify the storage of player face information.
Definition saveload.h:102
@ VehicleCurrencyStationChanges
Saveload version: 2.0, release: 0.3.0 Adding vehicle state, larger currency size for statistics,...
Definition saveload.h:34
@ TownTolerancePauseMode
Saveload version: 4.0, SVN revision: 1 Town council tolerance and pause mode.
Definition saveload.h:38
@ AircraftSpeedHolding
Saveload version: 50, SVN revision: 8973 Aircraft speed in km-ish/h and reduced speed in holding pat...
Definition saveload.h:104
@ SignTextColours
Saveload version: 363, GitHub pull request: 14743 Configurable sign text colors in scenario editor.
Definition saveload.h:415
@ CountIndividualCargoes
Saveload version: 170, SVN revision: 23826 Store the count of individual cargo delivery for a period...
Definition saveload.h:248
@ MaxLoanForCompany
Saveload version: 330, GitHub pull request: 11224 Separate max loan for each company.
Definition saveload.h:376
@ TrackRealAndAutoOrders
Saveload version: 158, SVN revision: 21933 Track which real and auto order is the current order.
Definition saveload.h:233
@ VehicleCentreAndZPos
Saveload version: 164, SVN revision: 23290 Vehicle centres are not fixed at 4/8 of the vehicle; chan...
Definition saveload.h:240
@ VirtualFeederSharePayment
Saveload version: 134, SVN revision: 18703 Pay a part of the virtual profit during a transfer to the...
Definition saveload.h:204
@ MaglevMonorailPaxWagonLivery
Saveload version: 85, SVN revision: 11874 Add livery for maglev/monorail passenger wagons.
Definition saveload.h:146
@ ShipCurvePenalty
Saveload version: 209, GitHub pull request: 7289 Configurable ship curve penalties.
Definition saveload.h:294
@ ScriptMemlimit
Saveload version: 215, GitHub pull request: 7516 Limit on AI/GS memory consumption.
Definition saveload.h:302
@ SimplifyPathfinderSettings
Saveload version: 87, SVN revision: 12129 Make it easier to select the pathfinder to use.
Definition saveload.h:148
@ RoadStopOccupancyPenalty
Saveload version: 130, SVN revision: 18404 Add configurable pathfinder penalty for an occupied road ...
Definition saveload.h:200
@ RemoveTownCargoCache
Saveload version: 219, GitHub pull request: 8258 Remove town cargo acceptance and production caches.
Definition saveload.h:306
@ NewGRFTownNames
Saveload version: 66, SVN revision: 10211 NewGRF provided town names.
Definition saveload.h:123
@ EconomyModeTimekeepingUnits
Saveload version: 327, GitHub pull request: 11341 Mode to display economy measurements in wallclock ...
Definition saveload.h:372
@ BigMap
Saveload version: 5.0, SVN revision: 1429 Making maps a different size than 256x256.
Definition saveload.h:44
@ DriveBackwards
Saveload version: 365, GitHub pull request: 15379 Trains can drive backwards.
Definition saveload.h:418
@ ProductionHistory
Saveload version: 343, GitHub pull request: 10541 Industry production history.
Definition saveload.h:391
@ MultipleRoadTypes
Saveload version: 61, SVN revision: 9892 Multiple road types for the same tile.
Definition saveload.h:117
@ MultitileDocks
Saveload version: 216, GitHub pull request: 7380 Multiple docks per station.
Definition saveload.h:303
@ LargerCargoSource
Saveload version: 7.0, SVN revision: 1770 With more stations, the size of the cargo source needed to...
Definition saveload.h:49
@ RailTrackTypeUnification
Saveload version: 48, SVN revision: 8935 Put all the rail track type information in same map bits.
Definition saveload.h:101
@ AnimatedTileStateInMap
Saveload version: 347, GitHub pull request: 13082 Animated tile state saved for improved performance...
Definition saveload.h:396
@ NewGRFIndustryRandomTriggers
Saveload version: 82, SVN revision: 11410 NewGRF random triggers for industries.
Definition saveload.h:142
@ NewGRFLastService
Saveload version: 317, GitHub pull request: 11124 Added stable date_of_last_service to avoid NewGRF ...
Definition saveload.h:360
@ LinkgraphSeconds
Saveload version: 308, GitHub pull request: 10610 Store linkgraph update intervals in seconds instea...
Definition saveload.h:349
@ GroupLiveries
Saveload version: 205, GitHub pull request: 7108 Livery storage change and group liveries.
Definition saveload.h:290
@ DisableTownLevelCrossing
Saveload version: 143, SVN revision: 20048 Setting to be able to disable building rail/road crossing...
Definition saveload.h:215
@ ShipAcceleration
Saveload version: 329, GitHub pull request: 10734 Start using Vehicle's acceleration field for ships...
Definition saveload.h:374
@ MaximumDepotPenalty
Saveload version: 131, SVN revision: 18481 Add configurable maximum pathfinder penalty for finding a...
Definition saveload.h:201
@ GamelogEmergency
Saveload version: 116, SVN revision: 15893, release: 0.7.x Gamelog event for emergency/crash saves.
Definition saveload.h:183
@ NewGRFPersistentStorage
Saveload version: 76, SVN revision: 11139 Persistently store some state of NewGRF objects/entities.
Definition saveload.h:135
@ SaveYapfSettings
Saveload version: 33, SVN revision: 6440 Some YAPF settings were not saved properly.
Definition saveload.h:83
@ TownAcceptance
Saveload version: 127, SVN revision: 17439 Store mask of cargos accepted by town houses and head qua...
Definition saveload.h:196
@ Distinguish16
Saveload version: 195, SVN revision: 27572, release: 1.6.1 Convenience bump to distinguish 1....
Definition saveload.h:278
@ MoreCargoPackets
Saveload version: 69, SVN revision: 10319 Allow more than ~65k cargo packets.
Definition saveload.h:126
@ LinkgraphLocationDisasterStore
Saveload version: 191, SVN revision: 26636, 26646 Fix disaster vehicle storage, Linkgraph - store lo...
Definition saveload.h:273
@ FixTreeGround
Saveload version: 81, SVN revision: 11244 Various fixes to improve the visuals of the ground under t...
Definition saveload.h:141
@ DriveThroughRoadStops
Saveload version: 47, SVN revision: 8735 Drive through road stops.
Definition saveload.h:100
@ U64TickCounter
Saveload version: 300, GitHub pull request: 10035 Make tick counter 64bit to avoid wrapping.
Definition saveload.h:340
@ MoreWaypointsPerTown
Saveload version: 89, SVN revision: 12160 Support more than 64 waypoints per town.
Definition saveload.h:150
@ TownGrowthControl
Saveload version: 54, SVN revision: 9613 Give the player control over the town growth.
Definition saveload.h:108
@ TransferOrder
Saveload version: 14.0, SVN revision: 2441 Transfer orders for feeder systems.
Definition saveload.h:58
@ SeparateOrderTravelWaitTime
Saveload version: 190, SVN revision: 26547 Separate order travel and wait times.
Definition saveload.h:272
@ RobustEnginePreview
Saveload version: 179, SVN revision: 24810 Make engine preview offers robust when company ranking ch...
Definition saveload.h:258
@ EncodedStringFormat
Saveload version: 350, GitHub pull request: 13499 Encoded String format changed.
Definition saveload.h:400
@ CleanupUnconnectedRoads
Saveload version: 77, SVN revision: 11172 Option to remove unconnected roads during a town's road re...
Definition saveload.h:136
@ AirportAnimationFrames
Saveload version: 137, SVN revision: 18912 Use animation frames instead of many airport tile ids for...
Definition saveload.h:208
@ IndustryManagement
Saveload version: 152, SVN revision: 21171 Manage the amount of industries that ought to be spawned ...
Definition saveload.h:226
@ FractionalCargoDelivery
Saveload version: 150, SVN revision: 20857 When spreading cargo over stations, spread fractional amo...
Definition saveload.h:224
@ RemoveAutosaveInterval
Saveload version: 23, SVN revision: 3915 Store autosave interval locally, instead of in savegame.
Definition saveload.h:71
@ RoadvehPathCache
Saveload version: 211, GitHub pull request: 7261 Add path cache for road vehicles.
Definition saveload.h:297
@ LinkWaypointToTown
Saveload version: 12.1, SVN revision: 2046 Link waypoints to towns and remove some bit stuffing.
Definition saveload.h:56
@ RemoveHouseCount
Saveload version: 92, SVN revision: 12381, release 0.6.x Remove number of houses in a town from the ...
Definition saveload.h:154
@ NewGRFHouses
Saveload version: 53, SVN revision: 9316 NewGRF controlled houses.
Definition saveload.h:107
@ FoundTown
Saveload version: 128, SVN revision: 18281 Founding of new towns.
Definition saveload.h:197
@ NonfloodingWaterTiles
Saveload version: 345, GitHub pull request: 13013 Store water tile non-flooding state.
Definition saveload.h:394
@ FixSccEncodedNegative
Saveload version: 353, GitHub pull request: 14049 Fix encoding of negative parameters.
Definition saveload.h:403
@ RefitOrders
Saveload version: 36, SVN revision: 6624 Vehicles can be refitted as part of an order.
Definition saveload.h:87
@ NewGRFRoadStops
Saveload version: 303, GitHub pull request: 10144 NewGRF road stops.
Definition saveload.h:343
@ RemoveOldPathfinder
Saveload version: 212, GitHub pull request: 7245 Remove OPF.
Definition saveload.h:298
@ ExtendIndustryCargoSlots
Saveload version: 202, GitHub pull request: 6867 Increase industry cargo slots to 16 in,...
Definition saveload.h:286
@ Rivers
Saveload version: 163, SVN revision: 22767 Rivers.
Definition saveload.h:239
@ UnifyGroundVehicles
Saveload version: 157, SVN revision: 21862 Unify the way ground vehicles are handled (articulated pa...
Definition saveload.h:232
@ RemoveSubsidyStationBinding
Saveload version: 125, SVN revision: 17113 Awarded subsidies are not bound to stations,...
Definition saveload.h:194
@ Autoslope
Saveload version: 75, SVN revision: 11107 Terraforming under buildings/track/anything that supports ...
Definition saveload.h:134
@ ImprovedOrders
Saveload version: 93, SVN revision: 12648 Orders support all full load/non stop types at the same ti...
Definition saveload.h:155
@ CargoSourceTile
Saveload version: 44, SVN revision: 8144 Store the source tile of the cargo, so accurate payment can...
Definition saveload.h:96
@ UngroupedVehicles
Saveload version: 71, SVN revision: 10567 Add a group with vehicles that aren't in any other group.
Definition saveload.h:129
@ Utf8
Saveload version: 37, SVN revision: 7182 UTF-8 strings.
Definition saveload.h:88
@ DisableElrailSetting
Saveload version: 38, SVN revision: 7195 Add setting to disable electrified rails.
Definition saveload.h:89
@ VehMotionCounter
Saveload version: 288, GitHub pull request: 8591 Desync safe motion counter.
Definition saveload.h:325
@ TimetableStartTicks
Saveload version: 321, GitHub pull request: 11468 Convert timetable start from a date to ticks.
Definition saveload.h:365
@ AIStartDate
Saveload version: 309, GitHub pull request: 10653 Removal of individual AI start dates and added a g...
Definition saveload.h:350
@ StoreAirportSize
Saveload version: 140, SVN revision: 19382 Store the size of the airport in the station.
Definition saveload.h:212
@ DepotsUnderBridges
Saveload version: 366, GitHub pull request: 15836 Allow depots under bridges.
Definition saveload.h:419
@ ExtendEntityMapping
Saveload version: 311, GitHub pull request: 10672 Extend entity mapping range.
Definition saveload.h:353
@ StoreWaypointIdInMap
Saveload version: 17.0, SVN revision: 3212 Store the ID of waypoints in m2 of the map.
Definition saveload.h:63
@ BuoysAt0_0
Saveload version: 364, GitHub pull request: 14983 Allow to build buoys at (0x0).
Definition saveload.h:416
@ PlatformStopLocation
Saveload version: 117, SVN revision: 16037 Set the platform stop location via train orders.
Definition saveload.h:184
@ CurrentOrderMaxSpeed
Saveload version: 174, SVN revision: 23973, release: 1.2.x Save maximum speed of current order.
Definition saveload.h:252
@ Distinguish17
Saveload version: 196, SVN revision: 27778, release: 1.7 Convenience bump to distinguish 1....
Definition saveload.h:279
@ SeparateRoadOwners
Saveload version: 114, SVN revision: 15601 Separate owners for road bits, tram bits and the road sto...
Definition saveload.h:180
@ TableChunks
Saveload version: 295, GitHub pull request: 9322 Introduction of ChunkType::Table and ChunkType::Spa...
Definition saveload.h:334
@ MoreCompanies
Saveload version: 104, SVN revision: 14735 Increase maximum number of companies to 15.
Definition saveload.h:168
@ NewGRFPalette
Saveload version: 101, SVN revision: 14233 Store palette used by each of the NewGRFs.
Definition saveload.h:165
@ MultipleRoadStops
Saveload version: 6.0, SVN revision: 1721 Multi tile road stops, and some map size related fixes.
Definition saveload.h:47
@ MoreCargoAge
Saveload version: 307, GitHub pull request: 10596 Track cargo age for a longer period.
Definition saveload.h:348
@ SavegameId
Saveload version: 313, GitHub pull request: 10719 Add an unique ID to every savegame (used to dedupl...
Definition saveload.h:355
@ VehicleGroups
Saveload version: 60, SVN revision: 9874 Arbitrary grouping, by the player, of vehicles.
Definition saveload.h:116
@ UnifyAnimationFrame
Saveload version: 147, SVN revision: 20621 Unify location of animation frame.
Definition saveload.h:220
@ ServiceIntervalPercent
Saveload version: 180, SVN revision: 24998, release: 1.3.x Service interval in percent or days store...
Definition saveload.h:260
@ AutoreplaceWhenOldTreeLimit
Saveload version: 175, SVN revision: 24136 Autoreplace vehicle only when they are old,...
Definition saveload.h:254
@ CargoPayments
Saveload version: 121, SVN revision: 16694 Perform payment of cargo after unloading.
Definition saveload.h:189
@ MultitrackLevelCrossings
Saveload version: 302, GitHub pull request: 9931, release: 13.0 Multi-track level crossings.
Definition saveload.h:342
@ CompanyAllowListV2
Saveload version: 341, GitHub pull request: 12908 Fixed savegame format for saving of list of client...
Definition saveload.h:389
@ PlaneSpeedFactor
Saveload version: 90, SVN revision: 12293 Setting to increase aircraft speed to be on par with the o...
Definition saveload.h:152
@ AILocalConfig
Saveload version: 332, GitHub pull request: 12003 Config of running AI is stored inside Company.
Definition saveload.h:378
@ StationsUnderBridges
Saveload version: 359, GitHub pull request: 14477 Allow stations under bridges.
Definition saveload.h:410
@ DisallowTreeBuilding
Saveload version: 132, SVN revision: 18522 Setting to partially disable building of trees.
Definition saveload.h:202
@ CumulatedInflation
Saveload version: 126, SVN revision: 17433 Store cumulated inflation, and recalculate prices/payment...
Definition saveload.h:195
@ TownCargogen
Saveload version: 208, GitHub pull request: 6965 New algorithms for town building cargo generation.
Definition saveload.h:293
@ NewGRFCustomCargoAging
Saveload version: 162, SVN revision: 22713 NewGRF influence on aging of cargo in vehicles.
Definition saveload.h:238
@ DisallowRoadReconstruction
Saveload version: 160, SVN revision: 21974, release: 1.1.x Setting to disallow road reconstruction.
Definition saveload.h:236
@ NextCompetitorStartOverflow
Saveload version: 109, SVN revision: 15075 Prevent overflow in the next competitor start counter.
Definition saveload.h:174
@ TimetableTicksType
Saveload version: 323, GitHub pull request: 11435 Convert timetable current order time to ticks.
Definition saveload.h:367
@ NewGRFAircraftRange
Saveload version: 167, SVN revision: 23504 NewGRF provided maximum aircraft range.
Definition saveload.h:244
@ LargerTownCounter
Saveload version: 10.0, SVN revision: 2030 Increase size of the town counter.
Definition saveload.h:53
@ LinkgraphTravelTime
Saveload version: 297, GitHub pull request: 9457, release: 12.0-RC1 Store travel time in the linkgra...
Definition saveload.h:336
@ Cargodist
Saveload version: 183, SVN revision: 25363 Cargodist.
Definition saveload.h:263
@ Elrail
Saveload version: 24, SVN revision: 4150 Electrified railways.
Definition saveload.h:72
@ TownSupplyHistory
Saveload version: 358, GitHub pull request: 14461 Town supply history.
Definition saveload.h:409
@ FixCargoMonitor
Saveload version: 207, GitHub pull request: 7175, release: 1.9 Cargo monitor data packing fix to sup...
Definition saveload.h:292
@ StoreMapVariety
Saveload version: 197, SVN revision: 27978, release: 1.8 Store map variety.
Definition saveload.h:280
@ NewGRFIndustryLayout
Saveload version: 73, SVN revision: 10903 NewGRF provided layouts for industries.
Definition saveload.h:131
@ RemoveOldAISettings
Saveload version: 110, SVN revision: 15148 Remove remnants of the old AI's configuration.
Definition saveload.h:176
@ ExtendVehicleRandom
Saveload version: 310, GitHub pull request: 10701 Extend vehicle random bits.
Definition saveload.h:352
@ CompanyServiceIntervals
Saveload version: 120, SVN revision: 16439 Make service intervals configurable per company.
Definition saveload.h:188
@ EngineMultiRailtype
Saveload version: 362, GitHub pull request: 14357, release: 15.0 Train engines can have multiple rai...
Definition saveload.h:414
@ MoreAirportBlocks
Saveload version: 46, SVN revision: 8705 Increase number of blocks an airport can have.
Definition saveload.h:99
@ ReducePlaneCrashes
Saveload version: 138, SVN revision: 18942, release: 1.0.x Setting to reduce/disable crashing of pla...
Definition saveload.h:209
@ RoadTypeLabelMap
Saveload version: 344, GitHub pull request: 13021 Add road type label map to allow upgrade/conversio...
Definition saveload.h:392
@ RocksStayUnderSnow
Saveload version: 135, SVN revision: 18719 Rocks stay under snow, i.e. they return when the snow goe...
Definition saveload.h:206
@ WaterRegions
Saveload version: 324, GitHub pull request: 10543 Water Regions for ship pathfinder.
Definition saveload.h:368
@ MinVersion
First savegame version.
Definition saveload.h:31
@ EconomyDate
Saveload version: 326, GitHub pull request: 10700 Split calendar and economy timers and dates.
Definition saveload.h:371
@ IndustryAcceptedHistory
Saveload version: 357, GitHub pull request: 14321 Add per-industry history of cargo delivered and wa...
Definition saveload.h:408
@ ScenarioDeitySigns
Saveload version: 171, SVN revision: 23835 Signs made in scenarios become of OWNER_DEITY,...
Definition saveload.h:249
@ OrderMaxSpeed
Saveload version: 172, SVN revision: 23947 Set maximum speed for orders.
Definition saveload.h:250
@ NewGRFSettings
Saveload version: 41, SVN revision: 7348, release: 0.5.x Save what NewGRFs are used in the game and ...
Definition saveload.h:93
@ MoreUnderBridges
Saveload version: 29, SVN revision: 5070 Support crossings, fields and bridge/tunnel heads under bri...
Definition saveload.h:78
@ MoreHouseAnimationFrames
Saveload version: 91, SVN revision: 12347 Increase number of animation frames for NewGRF houses.
Definition saveload.h:153
@ TradingAge
Saveload version: 217, GitHub pull request: 7780 Configurable company trading age.
Definition saveload.h:304
@ WaypointMoreLikeStation
Saveload version: 122, SVN revision: 16855 Make waypoint data look more like stations.
Definition saveload.h:190
@ ExtendRailtypes
Saveload version: 200, GitHub pull request: 6805 Extend railtypes to 64, adding uint16_t to map arra...
Definition saveload.h:284
@ RemoveLoadedAtXY
Saveload version: 318, GitHub pull request: 11276 Remove loaded_at_xy variable from CargoPacket.
Definition saveload.h:361
@ StoreAIVersion
Saveload version: 108, SVN revision: 15045 Store the version of the AI script.
Definition saveload.h:173
@ VeryLowTownIndustryNumber
Saveload version: 58, SVN revision: 9762 Difficulty settings for very low number of industries and t...
Definition saveload.h:113
@ ProtectPlacedHouses
Saveload version: 351, GitHub pull request: 13270 Houses individually placed by players can be prote...
Definition saveload.h:401
@ SplitLoadWaitCounters
Saveload version: 136, SVN revision: 18764 Split counters for (un)loading and signal waiting/turning...
Definition saveload.h:207
@ Storybooks
Saveload version: 185, SVN revision: 25620 Storybooks.
Definition saveload.h:266
@ LeaveRoadStopSeparately
Saveload version: 153, SVN revision: 21263 Fix issue where multiple vehicles could leave a road stop...
Definition saveload.h:227
@ IndustryCargoReorganise
Saveload version: 315, GitHub pull request: 10853 Industry accepts/produced data reorganised.
Definition saveload.h:358
@ StatueOwner
Saveload version: 52, SVN revision: 9066 Store the owner of the statue, so the town can be informed ...
Definition saveload.h:106
@ CompanyAllowList
Saveload version: 335, GitHub pull request: 12337 Saving of list of client keys that are allowed to ...
Definition saveload.h:382
@ SplitHQ
Saveload version: 112, SVN revision: 15290 Split the behaviour of headquarters from the other unmova...
Definition saveload.h:178
@ UniqueDepotNames
Saveload version: 141, SVN revision: 19799 Give depots unique names.
Definition saveload.h:213
@ DepotWaterOwners
Saveload version: 83, SVN revision: 11589 Store the owner of the water under depots,...
Definition saveload.h:143
@ LargerAIStateCounter
Saveload version: 13.1, SVN revision: 2080, releases: 0.4.0, 0.4.0.1 AI state counter increased due ...
Definition saveload.h:57
@ StoreNewGRFVersion
Saveload version: 151, SVN revision: 20918 Store the version of the used NewGRFs.
Definition saveload.h:225
@ FeederShare
Saveload version: 51, SVN revision: 8978 Rewrite of transfers to retain knowledge about the already ...
Definition saveload.h:105
@ TownGrowthInGameTicks
Saveload version: 198, GitHub pull request: 6763 Switch town growth rate and counter to actual game ...
Definition saveload.h:281
@ NewGRFMoreAnimation
Saveload version: 80, SVN revision: 11228 Support more types of animation for NewGRF industries.
Definition saveload.h:140
@ Tgp
Saveload version: 30, SVN revision: 5946 TerraGenesis Perlin.
Definition saveload.h:80
@ DepotUnbunching
Saveload version: 331, GitHub pull request: 11945 Allow unbunching shared order vehicles at a depot.
Definition saveload.h:377
@ ScriptInt64
Saveload version: 296, GitHub pull request: 9415 SQInteger is 64bit but was saved as 32bit.
Definition saveload.h:335
@ ShipsStopInLocks
Saveload version: 206, GitHub pull request: 7150 Ship/lock movement changes.
Definition saveload.h:291
@ IndustryTileWaterClass
Saveload version: 99, SVN revision: 13838 Add water classes to industry tiles.
Definition saveload.h:162
@ ScriptRandomizer
Saveload version: 333, GitHub pull request: 12063, release: 14.0-RC1 Save script randomizers.
Definition saveload.h:379
@ RepairObjectDockingTiles
Saveload version: 299, GitHub pull request: 9594, release: 12.0 Fixing issue with docking tiles over...
Definition saveload.h:338
@ RemoveOldPbs
Saveload version: 21, SVN revision: 3472, release: 0.4.x Remove old implementation of path based sig...
Definition saveload.h:69
@ IndustryNumValidHistory
Saveload version: 356, GitHub pull request: 14416 Store number of valid history records for industri...
Definition saveload.h:407
@ NewGRFDepotBuildDate
Saveload version: 142, SVN revision: 20003 Depot build date for NewGRFs.
Definition saveload.h:214
@ BiggerStationVariables
Saveload version: 3.0 Increase size of airport blocks/station build date.
Definition saveload.h:37
@ NewGRFAirportSmoke
Saveload version: 145, SVN revision: 20376 NewGRF support for airport and configurable amount of smo...
Definition saveload.h:218
@ CompanyInauguratedPeriod
Saveload version: 339, GitHub pull request: 12798 Companies show the period inaugurated in wallclock...
Definition saveload.h:386
@ MapgenSettingsRevamp
Saveload version: 290, GitHub pull request: 8891, release: 1.11 Revamp of some mapgen settings (snow...
Definition saveload.h:328
@ FixStationPickupAccounting
Saveload version: 74, SVN revision: 11030 Accounting of which cargos a station would pick up was don...
Definition saveload.h:132
@ DistantStationJoining
Saveload version: 106, SVN revision: 14919 Distant joining of stations.
Definition saveload.h:171
@ SaveloadListLength
Saveload version: 293, GitHub pull request: 9374 Consistency in list length with SaveLoadType::Struc...
Definition saveload.h:331
@ CustomSubsidyDuration
Saveload version: 292, GitHub pull request: 9081 Configurable subsidy duration.
Definition saveload.h:330
@ VelocityNautical
Saveload version: 305, GitHub pull request: 10594 Separation of land and nautical velocity (knots!...
Definition saveload.h:346
@ CalendarSubDateFract
Saveload version: 328, GitHub pull request: 11428 Add sub_date_fract to measure calendar days.
Definition saveload.h:373
@ ShipRotation
Saveload version: 204, GitHub pull request: 7065 Add extra rotation stages for ships.
Definition saveload.h:288
@ CustomTownNumber
Saveload version: 115, SVN revision: 15695 Configuration for specific number of towns to build.
Definition saveload.h:182
@ Liveries
Saveload version: 34, SVN revision: 6455 Liveries and two company colours (2cc).
Definition saveload.h:84
@ Timetables
Saveload version: 67, SVN revision: 10236 Introduce timetables for vehicles.
Definition saveload.h:124
@ DocksUnderBridges
Saveload version: 360, GitHub pull request: 14594 Allow docks under bridges.
Definition saveload.h:412
@ WaterRegionEvalSimplified
Saveload version: 325, GitHub pull request: 11750 Simplified Water Region evaluation.
Definition saveload.h:370
@ GroupNumbers
Saveload version: 336, GitHub pull request: 12297 Add per-company group numbers.
Definition saveload.h:383
@ RvRealisticAcceleration
Saveload version: 139, SVN revision: 19346 Realistic acceleration of road vehicles.
Definition saveload.h:210
@ ServeNeutralIndustries
Saveload version: 210, GitHub pull request: 7234 Company stations can serve industries with attached...
Definition saveload.h:296
@ ReorderUnmovableRemoveReserved
Saveload version: 144, SVN revision: 20334 Reorder map bits of unmovable tiles and remove unused res...
Definition saveload.h:216
@ Yapp
Saveload version: 100, SVN revision: 13952 New version of path based signals.
Definition saveload.h:164
@ MultiTileWaypoints
Saveload version: 124, SVN revision: 16993 Waypoints can be bigger than a single tile.
Definition saveload.h:192
@ FaceStyles
Saveload version: 355, GitHub pull request: 14319 Addition of face styles, replacing gender and ethn...
Definition saveload.h:406
@ NewGRFCargo
Saveload version: 55, SVN revision: 9638 Increase number of cargos and NewGRF control of cargos.
Definition saveload.h:110
@ CargoPackets
Saveload version: 68, SVN revision: 10266 Account for individual units of cargo, i....
Definition saveload.h:125
@ TerraformLimits
Saveload version: 156, SVN revision: 21728 Introduce limits for terraforming and clearing times.
Definition saveload.h:231
@ SeparateLocaleUnits
Saveload version: 184, SVN revision: 25508 Unit localisation split.
Definition saveload.h:264
@ TreesWaterClass
Saveload version: 213, GitHub pull request: 7405 WaterClass update for tree tiles.
Definition saveload.h:299
@ AdjacentStations
Saveload version: 62, SVN revision: 9905 Allow building multiple stations directly next to eachother...
Definition saveload.h:118
@ UnifyRvTravelTime
Saveload version: 188, SVN revision: 26169, release: 1.4 Unify RV travel time.
Definition saveload.h:269
@ MaxBridgeMapHeight
Saveload version: 194, SVN revision: 26881, release: 1.5 Setting for maximum bridge and map height.
Definition saveload.h:276
@ TimetableStart
Saveload version: 129, SVN revision: 18292 Allow setting the start date of a timetable.
Definition saveload.h:198
@ ScriptSaveInstances
Saveload version: 352, GitHub pull request: 13556 Scripts are allowed to save instances.
Definition saveload.h:402
@ NewGRFObjectView
Saveload version: 155, SVN revision: 21453 Support for views in NewGRF objects.
Definition saveload.h:230
@ MaxVersion
Highest possible saveload version.
Definition saveload.h:421
@ NoMultiheadReference
Saveload version: 20, SVN revision: 3403 Remove reference from one multihead to the other one.
Definition saveload.h:68
@ IndustryPlatform
Saveload version: 148, SVN revision: 20659 Setting to make a flat area around (new) industries.
Definition saveload.h:221
@ ScriptTownGrowth
Saveload version: 165, SVN revision: 23304 Storage of cargo statistics for use by game scripts.
Definition saveload.h:242
@ SpreadIndustryProductionChanges
Saveload version: 102, SVN revision: 14332 Spread the industry production changes over the month,...
Definition saveload.h:166
@ PauseLevel
Saveload version: 154, SVN revision: 21426 Setting to determine what commands are allowed when pause...
Definition saveload.h:228
@ FixCompanyCargoTypes
Saveload version: 94, SVN revision: 12816 The company's cargo types should have increased in since w...
Definition saveload.h:156
@ GradualLoading
Saveload version: 40, SVN revision: 7326 Gradual (un)loading of cargo.
Definition saveload.h:92
@ NewGRFStations
Saveload version: 27, SVN revision: 4757 NewGRF graphics for stations.
Definition saveload.h:76
@ FixRoadOwnership
Saveload version: 173, SVN revision: 23967, release: 1.2.0-RC1 Seemingly unneeded bump supposed to f...
Definition saveload.h:251
@ StartPatchpacks
Saveload version: 220 First known patchpack to use a version just above ours.
Definition saveload.h:321
@ ExtendPersistentStorage
Saveload version: 201, GitHub pull request: 6885 Extend NewGRF persistent storages.
Definition saveload.h:285
@ NoAI
Saveload version: 107, SVN revision: 15027 Replace built in cheating AI with framework for externall...
Definition saveload.h:172
@ LocksUnderBridges
Saveload version: 361, GitHub pull request: 14595 Allow locks under bridges.
Definition saveload.h:413
@ ScriptTownText
Saveload version: 168, SVN revision: 23637 Game scripts can put a text in the town window.
Definition saveload.h:245
@ UnifyWaterClass
Saveload version: 146, SVN revision: 20446 Unify location for storing water class in the map.
Definition saveload.h:219
@ Cities
Saveload version: 56, SVN revision: 9667 Cities that start bigger and grow faster.
Definition saveload.h:111
@ AirportNoise
Saveload version: 96, SVN revision: 13226 Introduce noise for airports, to allow more than two airpo...
Definition saveload.h:159
@ CargoPaymentOverflow
Saveload version: 70, SVN revision: 10541 Fix overflow of cargo payment rates, plus preparation for ...
Definition saveload.h:128
@ RiffToArray
Saveload version: 294, GitHub pull request: 9375 Changed many ChunkType::Riff chunks to ChunkType::A...
Definition saveload.h:332
@ FixOrderBackup
Saveload version: 192, SVN revision: 26700 Fix saving of order backups.
Definition saveload.h:274
@ BridgeWormhole
Saveload version: 42, SVN revision: 7573 Bridges become wormholes, so more things can be built under...
Definition saveload.h:94
@ TramLivery
Saveload version: 63, SVN revision: 9956 Add separate livery for trams.
Definition saveload.h:119
@ GSIndustryControl
Saveload version: 287, GitHub pull request: 7912 and 8115 GS industry control.
Definition saveload.h:324
@ LinkFarmFieldToIndustry
Saveload version: 32, SVN revision: 6001 Link farm fields to the industry, so it gets removed when t...
Definition saveload.h:82
@ ConsistentPartialZ
Saveload version: 306, GitHub pull request: 10570 Conversion from an inconsistent partial Z calculat...
Definition saveload.h:347
@ ScriptSettingsProfile
Saveload version: 178, SVN revision: 24789 Setting for the difficulty profile of AIs.
Definition saveload.h:257
@ HideEnginesForCompany
Saveload version: 193, SVN revision: 26802 Hiding of engines for a company.
Definition saveload.h:275
EncodedString GetSaveLoadErrorMessage()
Return the description of the error.
constexpr size_t SlVarSize(VarMemType type)
Return expect size in bytes of a VarType.
Definition saveload.h:819
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:1292
std::span< const struct SaveLoad > SaveLoadTable
A table of SaveLoad entries.
Definition saveload.h:536
void SlGlobList(const SaveLoadTable &slt)
Save or Load (a list of) global variables.
std::string GenerateDefaultSaveName()
Get the default name for a savegame or screenshot.
ChunkType
Type of a chunk.
Definition saveload.h:471
@ SparseTable
A SparseArray with a header describing the elements.
Definition saveload.h:476
@ ReadOnly
Chunk is never saved.
Definition saveload.h:479
@ Table
An Array with a header describing the elements.
Definition saveload.h:475
@ FileTypeMask
All ChunkType values that are saved in the file have to be within this mask.
Definition saveload.h:478
@ Riff
4 bits store the chunk type, 28 bits the number of bytes.
Definition saveload.h:472
@ SparseArray
Array of elements with index for each element.
Definition saveload.h:474
int64_t ReadValue(const void *ptr, VarMemType conv)
Return a signed-long version of the value of a setting.
Definition saveload.cpp:872
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.
Functions/types related to errors from savegames.
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.
Container for cargo from the same location and time.
Definition cargopacket.h:41
virtual void FixPointers() const
Fix the pointers.
Definition saveload.h:510
ChunkType type
Type of the chunk.
Definition saveload.h:485
virtual void LoadCheck(size_t len=0) const
Load the chunk for game preview.
virtual void Load() const =0
Load the chunk.
virtual ~ChunkHandler()=default
Ensure the destructor of the sub classes are called as well.
uint32_t id
Unique ID (4 letters).
Definition saveload.h:484
virtual void Save() const
Save the chunk.
Definition saveload.h:496
Struct to store engine replacements.
Deals with the type of the savegame, independent of extension.
Definition saveload.h:432
void SetMode(const FiosType &ft, SaveLoadOperation fop=SaveLoadOperation::Load)
Set the mode and file type of the file to save or load.
FiosType ftype
File type.
Definition saveload.h:434
SaveLoadOperation file_op
File operation to perform.
Definition saveload.h:433
std::string name
Name of the file.
Definition saveload.h:435
EncodedString title
Internal name of the game.
Definition saveload.h:436
void Set(const FiosItem &item)
Set the mode, title and name of the file.
Deals with finding savegames.
Definition fios.h:78
A savegame name automatically numbered.
Definition fios.h:119
Elements of a file system that are recognized.
Definition fileio_type.h:63
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:807
std::string_view name
Name of the field.
Definition saveload.h:808
SaveLoadVersion version_to
Save/load the variable before this savegame version.
Definition saveload.h:811
SaveLoadVersion version_from
Save/load the variable starting from this savegame version.
Definition saveload.h:810
uint16_t null_length
Length of the NULL field.
Definition saveload.h:809
SaveLoad type struct.
Definition saveload.h:787
uint16_t length
(Conditional) length of the variable (eg. arrays) (max array size is 65536 elements).
Definition saveload.h:791
std::shared_ptr< SaveLoadHandler > handler
Custom handler for Save/Load procs.
Definition saveload.h:796
SaveLoadAddrProc * address_proc
Callback proc the get the actual variable address in memory.
Definition saveload.h:794
SaveLoadVersion version_to
Save/load the variable before this savegame version.
Definition saveload.h:793
SaveLoadType cmd
The action to take with the saved/loaded type, All types need different action.
Definition saveload.h:789
std::string name
Name of this field (optional, used for tables).
Definition saveload.h:788
VarType conv
Type of the variable to be saved; this field combines both FileVarType and MemVarType.
Definition saveload.h:790
size_t extra_data
Extra data for the callback proc.
Definition saveload.h:795
SaveLoadVersion version_from
Save/load the variable starting from this savegame version.
Definition saveload.h:792
Station data structure.
Town data structure.
Definition town.h:64
Container of a variable's characteristics about a variable's storage.
Definition saveload.h:695
constexpr VarType()
Create an empty VarType.
Definition saveload.h:702
SLRefType ref
The reference type.
Definition saveload.h:699
VarMemType mem
The way of storing data in memory.
Definition saveload.h:697
StringValidationSettings string_validation_settings
Any settings related to validation of the strings.
Definition saveload.h:698
constexpr bool operator==(const VarType &other) const =default
Equality operator.
VarFileType file
The way of storing data in the file.
Definition saveload.h:696
constexpr VarType operator|(StringValidationSetting string_validation_setting) const
Transitional helper function to add a SaveLoadFlag to this type.
Definition saveload.h:729
constexpr VarType(VarFileType file, VarMemType mem)
Create a VarType with the given file and memory configurations.
Definition saveload.h:709
constexpr VarType(SLRefType ref)
Create a VarType linking to a reference.
Definition saveload.h:715
Container for holding some default VarType instances.
Definition saveload.h:749
static constexpr VarType U16
Store a 16 bits unsigned int.
Definition saveload.h:754
static constexpr VarType STRQ
Store a string with quotes.
Definition saveload.h:761
static constexpr VarType U8
Store a 8 bits unsigned int.
Definition saveload.h:752
static constexpr VarType STR
Store string.
Definition saveload.h:760
static constexpr VarType I16
Store a 16 bits signed int.
Definition saveload.h:753
static constexpr VarType NAME
A string stored in the custom string array.
Definition saveload.h:762
static constexpr VarType I64
Store a 64 bits signed int.
Definition saveload.h:757
static constexpr VarType U64
Store a 64 bits unsigned int.
Definition saveload.h:758
static constexpr VarType I8
Store a 8 bits signed int.
Definition saveload.h:751
static constexpr VarType U32
Store a 32 bits unsigned int.
Definition saveload.h:756
static constexpr VarType STRINGID
Store a StringID.
Definition saveload.h:759
static constexpr VarType I32
Store a 32 bits signed int.
Definition saveload.h:755
static constexpr VarType BOOL
Store a boolean (as int8).
Definition saveload.h:750
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