OpenTTD Source: src/saveload/saveload.h Source File

OpenTTD Source 1.11.0-RC1

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 <http://www.gnu.org/licenses/>.
6 */
7
10 #ifndef SAVELOAD_H
11 #define SAVELOAD_H
12
13 #include "../fileio_type.h"
14 #include "../strings_type.h"
15 #include <string>
16
30 enum SaveLoadVersion : uint16 {
31 SL_MIN_VERSION,
32
33 SLV_1,
34 SLV_2,
36 SLV_3,
37 SLV_4,
43 SLV_5,
46 SLV_6,
48 SLV_7,
49 SLV_8,
50 SLV_9,
51
52 SLV_10,
53 SLV_11,
55 SLV_12,
56 SLV_13,
57 SLV_14,
58
59 SLV_15,
60 SLV_16,
62 SLV_17,
64 SLV_18,
65 SLV_19,
66
67 SLV_20,
68 SLV_21,
69 SLV_22,
70 SLV_23,
71 SLV_24,
72
73 SLV_25,
74 SLV_26,
75 SLV_27,
76 SLV_28,
77 SLV_29,
78
79 SLV_30,
80 SLV_31,
81 SLV_32,
82 SLV_33,
83 SLV_34,
84
85 SLV_35,
86 SLV_36,
87 SLV_37,
88 SLV_38,
89 SLV_39,
90
91 SLV_40,
92 SLV_41,
93 SLV_42,
94 SLV_43,
95 SLV_44,
96
97 SLV_45,
98 SLV_46,
99 SLV_47,
100 SLV_48,
101 SLV_49,
102
103 SLV_50,
104 SLV_51,
105 SLV_52,
106 SLV_53,
107 SLV_54,
108
109 SLV_55,
110 SLV_56,
111 SLV_57,
112 SLV_58,
113 SLV_59,
114
115 SLV_60,
116 SLV_61,
117 SLV_62,
118 SLV_63,
119 SLV_64,
120
121 SLV_65,
122 SLV_66,
123 SLV_67,
124 SLV_68,
125 SLV_69,
126
127 SLV_70,
128 SLV_71,
129 SLV_72,
130 SLV_73,
131 SLV_74,
132
133 SLV_75,
134 SLV_76,
135 SLV_77,
136 SLV_78,
137 SLV_79,
138
139 SLV_80,
140 SLV_81,
141 SLV_82,
142 SLV_83,
143 SLV_84,
144
145 SLV_85,
146 SLV_86,
147 SLV_87,
148 SLV_88,
149 SLV_89,
150
151 SLV_90,
152 SLV_91,
153 SLV_92,
154 SLV_93,
155 SLV_94,
156
157 SLV_95,
158 SLV_96,
159 SLV_97,
160 SLV_98,
161 SLV_99,
162
163 SLV_100,
164 SLV_101,
165 SLV_102,
166 SLV_103,
167 SLV_104,
168
169 SLV_105,
170 SLV_106,
171 SLV_107,
172 SLV_108,
173 SLV_109,
174
175 SLV_110,
176 SLV_111,
177 SLV_112,
178 SLV_113,
179 SLV_114,
180
181 SLV_115,
182 SLV_116,
183 SLV_117,
184 SLV_118,
185 SLV_119,
186
187 SLV_120,
188 SLV_121,
189 SLV_122,
190 SLV_123,
191 SLV_124,
192
193 SLV_125,
194 SLV_126,
195 SLV_127,
196 SLV_128,
197 SLV_129,
198
199 SLV_130,
200 SLV_131,
201 SLV_132,
202 SLV_133,
203 SLV_134,
204
205 SLV_135,
206 SLV_136,
207 SLV_137,
208 SLV_138,
209 SLV_139,
210
211 SLV_140,
212 SLV_141,
213 SLV_142,
214 SLV_143,
215 SLV_144,
216
217 SLV_145,
218 SLV_146,
219 SLV_147,
220 SLV_148,
221 SLV_149,
222
223 SLV_150,
224 SLV_151,
225 SLV_152,
226 SLV_153,
227 SLV_154,
228
229 SLV_155,
230 SLV_156,
231 SLV_157,
232 SLV_158,
233 SLV_159,
234
235 SLV_160,
236 SLV_161,
237 SLV_162,
238 SLV_163,
239 SLV_164,
240
241 SLV_165,
242 SLV_166,
243 SLV_167,
244 SLV_168,
245 SLV_169,
246
247 SLV_170,
248 SLV_171,
249 SLV_172,
250 SLV_173,
251 SLV_174,
252
253 SLV_175,
254 SLV_176,
255 SLV_177,
256 SLV_178,
257 SLV_179,
258
259 SLV_180,
260 SLV_181,
261 SLV_182,
262 SLV_183,
263 SLV_184,
264
265 SLV_185,
266 SLV_186,
267 SLV_187,
268 SLV_188,
269 SLV_189,
270
271 SLV_190,
272 SLV_191,
273 SLV_192,
275 SLV_193,
276 SLV_194,
277
278 SLV_195,
279 SLV_196,
280 SLV_197,
281 SLV_198,
282 SLV_EXTEND_CARGOTYPES,
283
284 SLV_EXTEND_RAILTYPES,
285 SLV_EXTEND_PERSISTENT_STORAGE,
286 SLV_EXTEND_INDUSTRY_CARGO_SLOTS,
287 SLV_SHIP_PATH_CACHE,
288 SLV_SHIP_ROTATION,
289
290 SLV_GROUP_LIVERIES,
291 SLV_SHIPS_STOP_IN_LOCKS,
292 SLV_FIX_CARGO_MONITOR,
293 SLV_TOWN_CARGOGEN,
294 SLV_SHIP_CURVE_PENALTY,
295
296 SLV_SERVE_NEUTRAL_INDUSTRIES,
297 SLV_ROADVEH_PATH_CACHE,
298 SLV_REMOVE_OPF,
299 SLV_TREES_WATER_CLASS,
300 SLV_ROAD_TYPES,
301
302 SLV_SCRIPT_MEMLIMIT,
303 SLV_MULTITILE_DOCKS,
304 SLV_TRADING_AGE,
305 SLV_ENDING_YEAR,
306 SLV_REMOVE_TOWN_CARGO_CACHE,
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 he is 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 */
321 SLV_START_PATCHPACKS,
322 SLV_END_PATCHPACKS = 286,
323
324 SLV_GS_INDUSTRY_CONTROL,
325 SLV_VEH_MOTION_COUNTER,
326 SLV_INDUSTRY_TEXT,
327
328 SL_MAX_VERSION,
329 };
330
332 enum SaveOrLoadResult {
333 SL_OK = 0,
334 SL_ERROR = 1,
335 SL_REINIT = 2,
336 };
337
339 struct FileToSaveLoad {
340 SaveLoadOperation file_op;
341 DetailedFileType detail_ftype;
342 AbstractFileType abstract_ftype;
343 std::string name;
344 char title[255];
345
346 void SetMode(FiosType ft);
347 void SetMode(SaveLoadOperation fop, AbstractFileType aft, DetailedFileType dft);
348 void SetName(const char *name);
349 void SetTitle(const char *title);
350 };
351
353 enum SavegameType {
354 SGT_TTD,
355 SGT_TTDP1,
356 SGT_TTDP2,
357 SGT_OTTD,
358 SGT_TTO,
359 SGT_INVALID = 0xFF,
360 };
361
362 extern FileToSaveLoad _file_to_saveload;
363
364 void GenerateDefaultSaveName(char *buf, const char *last);
365 void SetSaveLoadError(StringID str);
366 const char *GetSaveLoadErrorString();
367 SaveOrLoadResult SaveOrLoad(const std::string &filename, SaveLoadOperation fop, DetailedFileType dft, Subdirectory sb, bool threaded = true);
368 void WaitTillSaved();
369 void ProcessAsyncSaveFinish();
370 void DoExitSave();
371
372 SaveOrLoadResult SaveWithFilter(struct SaveFilter *writer, bool threaded);
373 SaveOrLoadResult LoadWithFilter(struct LoadFilter *reader);
374
375 typedef void ChunkSaveLoadProc();
376 typedef void AutolengthProc(void *arg);
377
379 struct ChunkHandler {
380 uint32 id;
381 ChunkSaveLoadProc *save_proc;
382 ChunkSaveLoadProc *load_proc;
383 ChunkSaveLoadProc *ptrs_proc;
384 ChunkSaveLoadProc *load_check_proc;
385 uint32 flags;
386 };
387
389 enum SLRefType {
390 REF_ORDER = 0,
391 REF_VEHICLE = 1,
392 REF_STATION = 2,
393 REF_TOWN = 3,
394 REF_VEHICLE_OLD = 4,
395 REF_ROADSTOPS = 5,
396 REF_ENGINE_RENEWS = 6,
397 REF_CARGO_PACKET = 7,
398 REF_ORDERLIST = 8,
399 REF_STORAGE = 9,
400 REF_LINK_GRAPH = 10,
401 REF_LINK_GRAPH_JOB = 11,
402 };
403
405 enum ChunkType {
406 CH_RIFF = 0,
407 CH_ARRAY = 1,
408 CH_SPARSE_ARRAY = 2,
409 CH_TYPE_MASK = 3,
410 CH_LAST = 8,
411 };
412
421 enum VarTypes {
422 /* 4 bits allocated a maximum of 16 types for NumberType */
423 SLE_FILE_I8 = 0,
424 SLE_FILE_U8 = 1,
425 SLE_FILE_I16 = 2,
426 SLE_FILE_U16 = 3,
427 SLE_FILE_I32 = 4,
428 SLE_FILE_U32 = 5,
429 SLE_FILE_I64 = 6,
430 SLE_FILE_U64 = 7,
431 SLE_FILE_STRINGID = 8,
432 SLE_FILE_STRING = 9,
433 /* 6 more possible file-primitives */
434
435 /* 4 bits allocated a maximum of 16 types for NumberType */
436 SLE_VAR_BL = 0 << 4,
437 SLE_VAR_I8 = 1 << 4,
438 SLE_VAR_U8 = 2 << 4,
439 SLE_VAR_I16 = 3 << 4,
440 SLE_VAR_U16 = 4 << 4,
441 SLE_VAR_I32 = 5 << 4,
442 SLE_VAR_U32 = 6 << 4,
443 SLE_VAR_I64 = 7 << 4,
444 SLE_VAR_U64 = 8 << 4,
445 SLE_VAR_NULL = 9 << 4,
446 SLE_VAR_STRB = 10 << 4,
447 SLE_VAR_STRBQ = 11 << 4,
448 SLE_VAR_STR = 12 << 4,
449 SLE_VAR_STRQ = 13 << 4,
450 SLE_VAR_NAME = 14 << 4,
451 /* 1 more possible memory-primitives */
452
453 /* Shortcut values */
454 SLE_VAR_CHAR = SLE_VAR_I8,
455
456 /* Default combinations of variables. As savegames change, so can variables
457 * and thus it is possible that the saved value and internal size do not
458 * match and you need to specify custom combo. The defaults are listed here */
459 SLE_BOOL = SLE_FILE_I8 | SLE_VAR_BL,
460 SLE_INT8 = SLE_FILE_I8 | SLE_VAR_I8,
461 SLE_UINT8 = SLE_FILE_U8 | SLE_VAR_U8,
462 SLE_INT16 = SLE_FILE_I16 | SLE_VAR_I16,
463 SLE_UINT16 = SLE_FILE_U16 | SLE_VAR_U16,
464 SLE_INT32 = SLE_FILE_I32 | SLE_VAR_I32,
465 SLE_UINT32 = SLE_FILE_U32 | SLE_VAR_U32,
466 SLE_INT64 = SLE_FILE_I64 | SLE_VAR_I64,
467 SLE_UINT64 = SLE_FILE_U64 | SLE_VAR_U64,
468 SLE_CHAR = SLE_FILE_I8 | SLE_VAR_CHAR,
469 SLE_STRINGID = SLE_FILE_STRINGID | SLE_VAR_U32,
470 SLE_STRINGBUF = SLE_FILE_STRING | SLE_VAR_STRB,
471 SLE_STRINGBQUOTE = SLE_FILE_STRING | SLE_VAR_STRBQ,
472 SLE_STRING = SLE_FILE_STRING | SLE_VAR_STR,
473 SLE_STRINGQUOTE = SLE_FILE_STRING | SLE_VAR_STRQ,
474 SLE_NAME = SLE_FILE_STRINGID | SLE_VAR_NAME,
475
476 /* Shortcut values */
477 SLE_UINT = SLE_UINT32,
478 SLE_INT = SLE_INT32,
479 SLE_STRB = SLE_STRINGBUF,
480 SLE_STRBQ = SLE_STRINGBQUOTE,
481 SLE_STR = SLE_STRING,
482 SLE_STRQ = SLE_STRINGQUOTE,
483
484 /* 8 bits allocated for a maximum of 8 flags
485 * Flags directing saving/loading of a variable */
486 SLF_NOT_IN_SAVE = 1 << 8,
487 SLF_NOT_IN_CONFIG = 1 << 9,
488 SLF_NO_NETWORK_SYNC = 1 << 10,
489 SLF_ALLOW_CONTROL = 1 << 11,
490 SLF_ALLOW_NEWLINE = 1 << 12,
491 SLF_HEX = 1 << 13,
492 /* 2 more possible flags */
493 };
494
495 typedef uint32 VarType;
496
498 enum SaveLoadType : byte {
499 SL_VAR = 0,
500 SL_REF = 1,
501 SL_ARR = 2,
502 SL_STR = 3,
503 SL_LST = 4,
504 SL_DEQUE = 5,
505 SL_STDSTR = 6,
506 /* non-normal save-load types */
507 SL_WRITEBYTE = 8,
508 SL_VEH_INCLUDE = 9,
509 SL_ST_INCLUDE = 10,
510 SL_END = 15
511 };
512
513 typedef void *SaveLoadAddrProc(void *base, size_t extra);
514
516 struct SaveLoad {
517 SaveLoadType cmd;
518 VarType conv;
519 uint16 length;
520 SaveLoadVersion version_from;
521 SaveLoadVersion version_to;
522 size_t size;
523 SaveLoadAddrProc *address_proc;
524 size_t extra_data;
525 };
526
528 typedef SaveLoad SaveLoadGlobVarList;
529
541 #define SLE_GENERAL(cmd, base, variable, type, length, from, to, extra) {cmd, type, length, from, to, cpp_sizeof(base, variable), [] (void *b, size_t) -> void * { assert(b != nullptr); return const_cast<void *>(static_cast<const void *>(std::addressof(static_cast<base *>(b)->variable))); }, extra}
542
551 #define SLE_CONDVAR(base, variable, type, from, to) SLE_GENERAL(SL_VAR, base, variable, type, 0, from, to, 0)
552
561 #define SLE_CONDREF(base, variable, type, from, to) SLE_GENERAL(SL_REF, base, variable, type, 0, from, to, 0)
562
572 #define SLE_CONDARR(base, variable, type, length, from, to) SLE_GENERAL(SL_ARR, base, variable, type, length, from, to, 0)
573
583 #define SLE_CONDSTR(base, variable, type, length, from, to) SLE_GENERAL(SL_STR, base, variable, type, length, from, to, 0)
584
593 #define SLE_CONDSSTR(base, variable, type, from, to) SLE_GENERAL(SL_STDSTR, base, variable, type, 0, from, to, 0)
594
603 #define SLE_CONDLST(base, variable, type, from, to) SLE_GENERAL(SL_LST, base, variable, type, 0, from, to, 0)
604
613 #define SLE_CONDDEQUE(base, variable, type, from, to) SLE_GENERAL(SL_DEQUE, base, variable, type, 0, from, to, 0)
614
621 #define SLE_VAR(base, variable, type) SLE_CONDVAR(base, variable, type, SL_MIN_VERSION, SL_MAX_VERSION)
622
629 #define SLE_REF(base, variable, type) SLE_CONDREF(base, variable, type, SL_MIN_VERSION, SL_MAX_VERSION)
630
638 #define SLE_ARR(base, variable, type, length) SLE_CONDARR(base, variable, type, length, SL_MIN_VERSION, SL_MAX_VERSION)
639
647 #define SLE_STR(base, variable, type, length) SLE_CONDSTR(base, variable, type, length, SL_MIN_VERSION, SL_MAX_VERSION)
648
655 #define SLE_SSTR(base, variable, type) SLE_CONDSSTR(base, variable, type, SL_MIN_VERSION, SL_MAX_VERSION)
656
663 #define SLE_LST(base, variable, type) SLE_CONDLST(base, variable, type, SL_MIN_VERSION, SL_MAX_VERSION)
664
669 #define SLE_NULL(length) SLE_CONDNULL(length, SL_MIN_VERSION, SL_MAX_VERSION)
670
677 #define SLE_CONDNULL(length, from, to) {SL_ARR, SLE_FILE_U8 | SLE_VAR_NULL | SLF_NOT_IN_CONFIG, length, from, to, 0, nullptr, 0}
678
680 #define SLE_WRITEBYTE(base, variable) SLE_GENERAL(SL_WRITEBYTE, base, variable, 0, 0, SL_MIN_VERSION, SL_MAX_VERSION, 0)
681
682 #define SLE_VEH_INCLUDE() {SL_VEH_INCLUDE, 0, 0, SL_MIN_VERSION, SL_MAX_VERSION, 0, [] (void *b, size_t) { return b; }, 0}
683 #define SLE_ST_INCLUDE() {SL_ST_INCLUDE, 0, 0, SL_MIN_VERSION, SL_MAX_VERSION, 0, [] (void *b, size_t) { return b; }, 0}
684
686 #define SLE_END() {SL_END, 0, 0, SL_MIN_VERSION, SL_MIN_VERSION, 0, nullptr, 0}
687
698 #define SLEG_GENERAL(cmd, variable, type, length, from, to, extra) {cmd, type, length, from, to, sizeof(variable), [] (void *, size_t) -> void * { return static_cast<void *>(std::addressof(variable)); }, extra}
699
707 #define SLEG_CONDVAR(variable, type, from, to) SLEG_GENERAL(SL_VAR, variable, type, 0, from, to, 0)
708
716 #define SLEG_CONDREF(variable, type, from, to) SLEG_GENERAL(SL_REF, variable, type, 0, from, to, 0)
717
726 #define SLEG_CONDARR(variable, type, length, from, to) SLEG_GENERAL(SL_ARR, variable, type, length, from, to, 0)
727
736 #define SLEG_CONDSTR(variable, type, length, from, to) SLEG_GENERAL(SL_STR, variable, type, length, from, to, 0)
737
745 #define SLEG_CONDSSTR(variable, type, from, to) SLEG_GENERAL(SL_STDSTR, variable, type, 0, from, to, 0)
746
754 #define SLEG_CONDLST(variable, type, from, to) SLEG_GENERAL(SL_LST, variable, type, 0, from, to, 0)
755
761 #define SLEG_VAR(variable, type) SLEG_CONDVAR(variable, type, SL_MIN_VERSION, SL_MAX_VERSION)
762
768 #define SLEG_REF(variable, type) SLEG_CONDREF(variable, type, SL_MIN_VERSION, SL_MAX_VERSION)
769
775 #define SLEG_ARR(variable, type) SLEG_CONDARR(variable, type, lengthof(variable), SL_MIN_VERSION, SL_MAX_VERSION)
776
782 #define SLEG_STR(variable, type) SLEG_CONDSTR(variable, type, sizeof(variable), SL_MIN_VERSION, SL_MAX_VERSION)
783
789 #define SLEG_SSTR(variable, type) SLEG_CONDSSTR(variable, type, SL_MIN_VERSION, SL_MAX_VERSION)
790
796 #define SLEG_LST(variable, type) SLEG_CONDLST(variable, type, SL_MIN_VERSION, SL_MAX_VERSION)
797
804 #define SLEG_CONDNULL(length, from, to) {SL_ARR, SLE_FILE_U8 | SLE_VAR_NULL | SLF_NOT_IN_CONFIG, length, from, to, 0, nullptr, 0}
805
807 #define SLEG_END() {SL_END, 0, 0, SL_MIN_VERSION, SL_MIN_VERSION, 0, nullptr, 0}
808
815 static inline bool IsSavegameVersionBefore(SaveLoadVersion major, byte minor = 0)
816 {
817 extern SaveLoadVersion _sl_version;
818 extern byte _sl_minor_version;
819 return _sl_version < major || (minor > 0 && _sl_version == major && _sl_minor_version < minor);
820 }
821
829 static inline bool IsSavegameVersionUntil(SaveLoadVersion major)
830 {
831 extern SaveLoadVersion _sl_version;
832 return _sl_version <= major;
833 }
834
842 static inline bool SlIsObjectCurrentlyValid(SaveLoadVersion version_from, SaveLoadVersion version_to)
843 {
844 extern const SaveLoadVersion SAVEGAME_VERSION;
845 if (SAVEGAME_VERSION < version_from || SAVEGAME_VERSION >= version_to) return false;
846
847 return true;
848 }
849
856 static inline VarType GetVarMemType(VarType type)
857 {
858 return type & 0xF0; // GB(type, 4, 4) << 4;
859 }
860
867 static inline VarType GetVarFileType(VarType type)
868 {
869 return type & 0xF; // GB(type, 0, 4);
870 }
871
877 static inline bool IsNumericType(VarType conv)
878 {
879 return GetVarMemType(conv) <= SLE_VAR_U64;
880 }
881
887 static inline void *GetVariableAddress(const void *object, const SaveLoad *sld)
888 {
889 /* Entry is a null-variable, mostly used to read old savegames etc. */
890 if (GetVarMemType(sld->conv) == SLE_VAR_NULL) {
891 assert(sld->address_proc == nullptr);
892 return nullptr;
893 }
894
895 /* Everything else should be a non-null pointer. */
896 assert(sld->address_proc != nullptr);
897 return sld->address_proc(const_cast<void *>(object), sld->extra_data);
898 }
899
900 int64 ReadValue(const void *ptr, VarType conv);
901 void WriteValue(void *ptr, VarType conv, int64 val);
902
903 void SlSetArrayIndex(uint index);
904 int SlIterateArray();
905
906 void SlAutolength(AutolengthProc *proc, void *arg);
907 size_t SlGetFieldLength();
908 void SlSetLength(size_t length);
909 size_t SlCalcObjMemberLength(const void *object, const SaveLoad *sld);
910 size_t SlCalcObjLength(const void *object, const SaveLoad *sld);
911
912 byte SlReadByte();
913 void SlWriteByte(byte b);
914
915 void SlGlobList(const SaveLoadGlobVarList *sldg);
916 void SlArray(void *array, size_t length, VarType conv);
917 void SlObject(void *object, const SaveLoad *sld);
918 bool SlObjectMember(void *object, const SaveLoad *sld);
919 void NORETURN SlError(StringID string, const char *extra_msg = nullptr);
920 void NORETURN SlErrorCorrupt(const char *msg);
921 void NORETURN SlErrorCorruptFmt(const char *format, ...) WARN_FORMAT(1, 2);
922
923 bool SaveloadCrashWithMissingNewGRFs();
924
930 static inline void SlSkipBytes(size_t length)
931 {
932 for (; length != 0; length--) SlReadByte();
933 }
934
935 extern char _savegame_format[8];
936 extern bool _do_autosave;
937
938 #endif /* SAVELOAD_H */
FileToSaveLoad::title
char title[255]
Internal name of the game.
Definition: saveload.h:344
SLV_131
@ SLV_131
131 18481
Definition: saveload.h:200
SGT_INVALID
@ SGT_INVALID
broken savegame (used internally)
Definition: saveload.h:359
SLV_187
@ SLV_187
187 25899 Linkgraph - restricted flows
Definition: saveload.h:267
SLV_65
@ SLV_65
65 10210
Definition: saveload.h:121
SaveLoad::version_to
SaveLoadVersion version_to
save/load the variable until this savegame version
Definition: saveload.h:521
SLV_186
@ SLV_186
186 25833 Objects storage
Definition: saveload.h:266
SLV_69
@ SLV_69
69 10319
Definition: saveload.h:125
REF_ORDER
@ REF_ORDER
Load/save a reference to an order.
Definition: saveload.h:390
SLV_144
@ SLV_144
144 20334
Definition: saveload.h:215
SaveLoadType
SaveLoadType
Type of data saved.
Definition: saveload.h:498
SLV_169
@ SLV_169
169 23816
Definition: saveload.h:245
SLV_43
@ SLV_43
43 7642
Definition: saveload.h:94
SLV_114
@ SLV_114
114 15601
Definition: saveload.h:179
SGT_OTTD
@ SGT_OTTD
OTTD savegame.
Definition: saveload.h:357
SLF_NOT_IN_SAVE
@ SLF_NOT_IN_SAVE
do not save with savegame, basically client-based
Definition: saveload.h:486
SLV_62
@ SLV_62
62 9905
Definition: saveload.h:117
SLE_VAR_STR
@ SLE_VAR_STR
string pointer
Definition: saveload.h:448
SLV_TREES_WATER_CLASS
@ SLV_TREES_WATER_CLASS
213 PR#7405 WaterClass update for tree tiles.
Definition: saveload.h:299
GetVarFileType
static VarType GetVarFileType(VarType type)
Get the FileType of a setting.
Definition: saveload.h:867
SLV_162
@ SLV_162
162 22713
Definition: saveload.h:237
SlErrorCorrupt
void NORETURN SlErrorCorrupt(const char *msg)
Error handler for corrupt savegames.
Definition: saveload.cpp:358
SLV_ROAD_TYPES
@ SLV_ROAD_TYPES
214 PR#6811 NewGRF road types.
Definition: saveload.h:300
SLV_133
@ SLV_133
133 18674
Definition: saveload.h:202
SL_MIN_VERSION
@ SL_MIN_VERSION
First savegame version.
Definition: saveload.h:31
REF_TOWN
@ REF_TOWN
Load/save a reference to a town.
Definition: saveload.h:393
SLV_85
@ SLV_85
85 11874
Definition: saveload.h:145
SLV_106
@ SLV_106
106 14919
Definition: saveload.h:170
SLV_40
@ SLV_40
40 7326
Definition: saveload.h:91
SL_STR
@ SL_STR
Save/load a string.
Definition: saveload.h:502
ProcessAsyncSaveFinish
void ProcessAsyncSaveFinish()
Handle async save finishes.
Definition: saveload.cpp:402
REF_ROADSTOPS
@ REF_ROADSTOPS
Load/save a reference to a bus/truck stop.
Definition: saveload.h:395
FileToSaveLoad::SetTitle
void SetTitle(const char *title)
Set the title of the file.
Definition: saveload.cpp:2932
SLV_32
@ SLV_32
32 6001
Definition: saveload.h:81
SLV_155
@ SLV_155
155 21453
Definition: saveload.h:229
SLV_178
@ SLV_178
178 24789
Definition: saveload.h:256
SLV_124
@ SLV_124
124 16993
Definition: saveload.h:191
SLV_112
@ SLV_112
112 15290
Definition: saveload.h:177
SLV_49
@ SLV_49
49 8969
Definition: saveload.h:101
SLV_146
@ SLV_146
146 20446
Definition: saveload.h:218
SLV_198
@ SLV_198
198 PR#6763 Switch town growth rate and counter to actual game ticks
Definition: saveload.h:281
SaveLoadOperation
SaveLoadOperation
Operation performed on the file.
Definition: fileio_type.h:47
SLV_117
@ SLV_117
117 16037
Definition: saveload.h:183
FileToSaveLoad::name
std::string name
Name of the file.
Definition: saveload.h:343
SlArray
void SlArray(void *array, size_t length, VarType conv)
Save/Load an array.
Definition: saveload.cpp:1051
SLV_29
@ SLV_29
29 5070
Definition: saveload.h:77
SLV_79
@ SLV_79
79 11188
Definition: saveload.h:137
_do_autosave
bool _do_autosave
are we doing an autosave at the moment?
Definition: saveload.cpp:68
SaveLoad::size
size_t size
the sizeof size.
Definition: saveload.h:522
SLV_96
@ SLV_96
96 13226
Definition: saveload.h:158
_savegame_format
char _savegame_format[8]
how to compress savegames
Definition: saveload.cpp:67
SLV_166
@ SLV_166
166 23415
Definition: saveload.h:242
SLV_56
@ SLV_56
56 9667
Definition: saveload.h:110
SLF_ALLOW_NEWLINE
@ SLF_ALLOW_NEWLINE
allow new lines in the strings
Definition: saveload.h:490
SLV_84
@ SLV_84
84 11822
Definition: saveload.h:143
SLV_93
@ SLV_93
93 12648
Definition: saveload.h:154
SLV_52
@ SLV_52
52 9066
Definition: saveload.h:105
SLE_STR
#define SLE_STR(base, variable, type, length)
Storage of a string in every savegame version.
Definition: saveload.h:647
SLV_157
@ SLV_157
157 21862
Definition: saveload.h:231
SLE_VAR_STRBQ
@ SLE_VAR_STRBQ
string enclosed in quotes (with pre-allocated buffer)
Definition: saveload.h:447
SLV_119
@ SLV_119
119 16242
Definition: saveload.h:185
SLV_SHIPS_STOP_IN_LOCKS
@ SLV_SHIPS_STOP_IN_LOCKS
206 PR#7150 Ship/lock movement changes.
Definition: saveload.h:291
SLV_FIX_CARGO_MONITOR
@ SLV_FIX_CARGO_MONITOR
207 PR#7175 v1.9 Cargo monitor data packing fix to support 64 cargotypes.
Definition: saveload.h:292
SGT_TTDP1
@ SGT_TTDP1
TTDP savegame ( -//- ) (data at NW border)
Definition: saveload.h:355
SLV_66
@ SLV_66
66 10211
Definition: saveload.h:122
FileToSaveLoad
Deals with the type of the savegame, independent of extension.
Definition: saveload.h:339
FileToSaveLoad::SetName
void SetName(const char *name)
Set the name of the file.
Definition: saveload.cpp:2923
SLV_87
@ SLV_87
87 12129
Definition: saveload.h:147
SLV_20
@ SLV_20
20 3403
Definition: saveload.h:67
SLE_VAR_NULL
@ SLE_VAR_NULL
useful to write zeros in savegame.
Definition: saveload.h:445
SaveOrLoad
SaveOrLoadResult SaveOrLoad(const std::string &filename, SaveLoadOperation fop, DetailedFileType dft, Subdirectory sb, bool threaded=true)
Main Save or Load function where the high-level saveload functions are handled.
Definition: saveload.cpp:2764
CH_LAST
@ CH_LAST
Last chunk in this array.
Definition: saveload.h:410
SLV_88
@ SLV_88
88 12134
Definition: saveload.h:148
SLV_78
@ SLV_78
78 11176
Definition: saveload.h:136
SlObject
void SlObject(void *object, const SaveLoad *sld)
Main SaveLoad function.
Definition: saveload.cpp:1612
SaveLoad::length
uint16 length
(conditional) length of the variable (eg. arrays) (max array size is 65536 elements)
Definition: saveload.h:519
SLV_138
@ SLV_138
138 18942 1.0.x
Definition: saveload.h:208
SLV_35
@ SLV_35
35 6602
Definition: saveload.h:85
SLV_22
@ SLV_22
22 3726
Definition: saveload.h:69
SLV_104
@ SLV_104
104 14735
Definition: saveload.h:167
SLV_SERVE_NEUTRAL_INDUSTRIES
@ SLV_SERVE_NEUTRAL_INDUSTRIES
210 PR#7234 Company stations can serve industries with attached neutral stations.
Definition: saveload.h:296
SLV_15
@ SLV_15
15.0 2499
Definition: saveload.h:59
SLV_REMOVE_OPF
@ SLV_REMOVE_OPF
212 PR#7245 Remove OPF.
Definition: saveload.h:298
SAVEGAME_VERSION
const SaveLoadVersion SAVEGAME_VERSION
current savegame version
SLV_113
@ SLV_113
113 15340
Definition: saveload.h:178
ChunkHandler
Handlers and description of chunk.
Definition: saveload.h:379
SaveLoad::conv
VarType conv
type of the variable to be saved, int
Definition: saveload.h:518
SLV_102
@ SLV_102
102 14332
Definition: saveload.h:165
SLF_NO_NETWORK_SYNC
@ SLF_NO_NETWORK_SYNC
do not synchronize over network (but it is saved if SLF_NOT_IN_SAVE is not set)
Definition: saveload.h:488
SLV_181
@ SLV_181
181 25012
Definition: saveload.h:260
SLV_175
@ SLV_175
175 24136
Definition: saveload.h:253
SLV_GROUP_LIVERIES
@ SLV_GROUP_LIVERIES
205 PR#7108 Livery storage change and group liveries.
Definition: saveload.h:290
SLV_83
@ SLV_83
83 11589
Definition: saveload.h:142
SLV_76
@ SLV_76
76 11139
Definition: saveload.h:134
SLV_53
@ SLV_53
53 9316
Definition: saveload.h:106
SLF_HEX
@ SLF_HEX
print numbers as hex in the config file (only useful for unsigned)
Definition: saveload.h:491
SLV_163
@ SLV_163
163 22767
Definition: saveload.h:238
SLV_179
@ SLV_179
179 24810
Definition: saveload.h:257
SLV_100
@ SLV_100
100 13952
Definition: saveload.h:163
SLV_141
@ SLV_141
141 19799
Definition: saveload.h:212
SLV_172
@ SLV_172
172 23947
Definition: saveload.h:249
SLV_EXTEND_PERSISTENT_STORAGE
@ SLV_EXTEND_PERSISTENT_STORAGE
201 PR#6885 Extend NewGRF persistent storages.
Definition: saveload.h:285
SLV_14
@ SLV_14
14.0 2441
Definition: saveload.h:57
SlIterateArray
int SlIterateArray()
Iterate through the elements of an array and read the whole thing.
Definition: saveload.cpp:631
SLV_61
@ SLV_61
61 9892
Definition: saveload.h:116
IsSavegameVersionUntil
static bool IsSavegameVersionUntil(SaveLoadVersion major)
Checks whether the savegame is below or at major.
Definition: saveload.h:829
SLV_41
@ SLV_41
41 7348 0.5.x
Definition: saveload.h:92
SLV_10
@ SLV_10
10.0 2030
Definition: saveload.h:52
GenerateDefaultSaveName
void GenerateDefaultSaveName(char *buf, const char *last)
Fill the buffer with the default name for a savegame or screenshot.
Definition: saveload.cpp:2861
GetSaveLoadErrorString
const char * GetSaveLoadErrorString()
Get the string representation of the error message.
Definition: saveload.cpp:2474
SLV_118
@ SLV_118
118 16129
Definition: saveload.h:184
REF_STATION
@ REF_STATION
Load/save a reference to a station.
Definition: saveload.h:392
SLV_98
@ SLV_98
98 13375
Definition: saveload.h:160
SlWriteByte
void SlWriteByte(byte b)
Wrapper for writing a byte to the dumper.
Definition: saveload.cpp:427
SaveLoadGlobVarList
SaveLoad SaveLoadGlobVarList
Same as SaveLoad but global variables are used (for better readability);.
Definition: saveload.h:528
SLE_VAR_STRB
@ SLE_VAR_STRB
string (with pre-allocated buffer)
Definition: saveload.h:446
IsNumericType
static bool IsNumericType(VarType conv)
Check if the given saveload type is a numeric type.
Definition: saveload.h:877
SLV_EXTEND_INDUSTRY_CARGO_SLOTS
@ SLV_EXTEND_INDUSTRY_CARGO_SLOTS
202 PR#6867 Increase industry cargo slots to 16 in, 16 out
Definition: saveload.h:286
SLV_160
@ SLV_160
160 21974 1.1.x
Definition: saveload.h:235
AbstractFileType
AbstractFileType
The different abstract types of files that the system knows about.
Definition: fileio_type.h:16
FileToSaveLoad::abstract_ftype
AbstractFileType abstract_ftype
Abstract type of file (scenario, heightmap, etc).
Definition: saveload.h:342
SLV_135
@ SLV_135
135 18719
Definition: saveload.h:205
SlSetLength
void SlSetLength(size_t length)
Sets the length of either a RIFF object or the number of items in an array.
Definition: saveload.cpp:676
SLV_154
@ SLV_154
154 21426
Definition: saveload.h:227
SLV_5
@ SLV_5
5.0 1429 5.1 1440 5.2 1525 0.3.6
Definition: saveload.h:43
SLV_174
@ SLV_174
174 23973 1.2.x
Definition: saveload.h:251
SLV_161
@ SLV_161
161 22567
Definition: saveload.h:236
SLF_ALLOW_CONTROL
@ SLF_ALLOW_CONTROL
allow control codes in the strings
Definition: saveload.h:489
SLV_156
@ SLV_156
156 21728
Definition: saveload.h:230
SLV_108
@ SLV_108
108 15045
Definition: saveload.h:172
SLV_111
@ SLV_111
111 15190
Definition: saveload.h:176
SLV_123
@ SLV_123
123 16909
Definition: saveload.h:190
SavegameType
SavegameType
Types of save games.
Definition: saveload.h:353
SLV_150
@ SLV_150
150 20857
Definition: saveload.h:223
SLV_115
@ SLV_115
115 15695
Definition: saveload.h:181
ChunkHandler::load_check_proc
ChunkSaveLoadProc * load_check_proc
Load procedure for game preview.
Definition: saveload.h:384
SLV_55
@ SLV_55
55 9638
Definition: saveload.h:109
SLV_164
@ SLV_164
164 23290
Definition: saveload.h:239
SGT_TTO
@ SGT_TTO
TTO savegame.
Definition: saveload.h:358
SLV_31
@ SLV_31
31 5999
Definition: saveload.h:80
SetSaveLoadError
void SetSaveLoadError(StringID str)
Set the error message from outside of the actual loading/saving of the game (AfterLoadGame and friend...
Definition: saveload.cpp:2468
SLV_MULTITILE_DOCKS
@ SLV_MULTITILE_DOCKS
216 PR#7380 Multiple docks per station.
Definition: saveload.h:303
ChunkHandler::id
uint32 id
Unique ID (4 letters).
Definition: saveload.h:380
SL_VAR
@ SL_VAR
Save/load a variable.
Definition: saveload.h:499
SLV_11
@ SLV_11
11.0 2033 11.1 2041
Definition: saveload.h:53
SLV_REMOVE_TOWN_CARGO_CACHE
@ SLV_REMOVE_TOWN_CARGO_CACHE
219 PR#8258 Remove town cargo acceptance and production caches.
Definition: saveload.h:306
SLV_67
@ SLV_67
67 10236
Definition: saveload.h:123
SLV_SCRIPT_MEMLIMIT
@ SLV_SCRIPT_MEMLIMIT
215 PR#7516 Limit on AI/GS memory consumption.
Definition: saveload.h:302
SLV_176
@ SLV_176
176 24446
Definition: saveload.h:254
SaveLoad::extra_data
size_t extra_data
extra data for the callback proc
Definition: saveload.h:524
SLV_126
@ SLV_126
126 17433
Definition: saveload.h:194
SLV_132
@ SLV_132
132 18522
Definition: saveload.h:201
SLV_86
@ SLV_86
86 12042
Definition: saveload.h:146
SL_REINIT
@ SL_REINIT
error that was caught in the middle of updating game state, need to clear it. (can only happen during...
Definition: saveload.h:335
SaveLoad::cmd
SaveLoadType cmd
the action to take with the saved/loaded type, All types need different action
Definition: saveload.h:517
SLV_END_PATCHPACKS
@ SLV_END_PATCHPACKS
286 Last known patchpack to use a version just above ours.
Definition: saveload.h:322
SLV_27
@ SLV_27
27 4757
Definition: saveload.h:75
SLV_158
@ SLV_158
158 21933
Definition: saveload.h:232
SLV_130
@ SLV_130
130 18404
Definition: saveload.h:199
SLRefType
SLRefType
Type of reference (SLE_REF, SLE_CONDREF).
Definition: saveload.h:389
SLV_73
@ SLV_73
73 10903
Definition: saveload.h:130
SLV_46
@ SLV_46
46 8705
Definition: saveload.h:98
SLV_94
@ SLV_94
94 12816
Definition: saveload.h:155
SLV_74
@ SLV_74
74 11030
Definition: saveload.h:131
SLV_109
@ SLV_109
109 15075
Definition: saveload.h:173
SlAutolength
void SlAutolength(AutolengthProc *proc, void *arg)
Do something of which I have no idea what it is :P.
Definition: saveload.cpp:1640
SLV_54
@ SLV_54
54 9613
Definition: saveload.h:107
SLV_ROADVEH_PATH_CACHE
@ SLV_ROADVEH_PATH_CACHE
211 PR#7261 Add path cache for road vehicles.
Definition: saveload.h:297
SLV_TOWN_CARGOGEN
@ SLV_TOWN_CARGOGEN
208 PR#6965 New algorithms for town building cargo generation.
Definition: saveload.h:293
SLV_128
@ SLV_128
128 18281
Definition: saveload.h:196
ChunkHandler::flags
uint32 flags
Flags of the chunk.
Definition: saveload.h:385
SLV_EXTEND_CARGOTYPES
@ SLV_EXTEND_CARGOTYPES
199 PR#6802 Extend cargotypes to 64
Definition: saveload.h:282
SL_ARR
@ SL_ARR
Save/load an array.
Definition: saveload.h:501
SLE_FILE_STRINGID
@ SLE_FILE_STRINGID
StringID offset into strings-array.
Definition: saveload.h:431
REF_STORAGE
@ REF_STORAGE
Load/save a reference to a persistent storage.
Definition: saveload.h:399
SLV_168
@ SLV_168
168 23637
Definition: saveload.h:244
SaveLoadVersion
SaveLoadVersion
SaveLoad versions Previous savegame versions, the trunk revision where they were introduced and the r...
Definition: saveload.h:30
SLV_82
@ SLV_82
82 11410
Definition: saveload.h:141
SLV_183
@ SLV_183
183 25363 Cargodist
Definition: saveload.h:262
SLV_120
@ SLV_120
120 16439
Definition: saveload.h:187
IsSavegameVersionBefore
static bool IsSavegameVersionBefore(SaveLoadVersion major, byte minor=0)
Checks whether the savegame is below major.
Definition: saveload.h:815
SLV_45
@ SLV_45
45 8501
Definition: saveload.h:97
SLV_90
@ SLV_90
90 12293
Definition: saveload.h:151
REF_ENGINE_RENEWS
@ REF_ENGINE_RENEWS
Load/save a reference to an engine renewal (autoreplace).
Definition: saveload.h:396
SlGlobList
void SlGlobList(const SaveLoadGlobVarList *sldg)
Save or Load (a list of) global variables.
Definition: saveload.cpp:1630
ChunkHandler::ptrs_proc
ChunkSaveLoadProc * ptrs_proc
Manipulate pointers in the chunk.
Definition: saveload.h:383
SLV_116
@ SLV_116
116 15893 0.7.x
Definition: saveload.h:182
SLV_125
@ SLV_125
125 17113
Definition: saveload.h:193
SLV_7
@ SLV_7
7.0 1770
Definition: saveload.h:48
REF_VEHICLE
@ REF_VEHICLE
Load/save a reference to a vehicle.
Definition: saveload.h:391
SL_REF
@ SL_REF
Save/load a reference.
Definition: saveload.h:500
REF_CARGO_PACKET
@ REF_CARGO_PACKET
Load/save a reference to a cargo packet.
Definition: saveload.h:397
SLV_23
@ SLV_23
23 3915
Definition: saveload.h:70
SLV_25
@ SLV_25
25 4259
Definition: saveload.h:73
_file_to_saveload
FileToSaveLoad _file_to_saveload
File to save or load in the openttd loop.
Definition: saveload.cpp:62
SLV_182
@ SLV_182
182 25115 FS#5492, r25259, r25296 Goal status
Definition: saveload.h:261
REF_VEHICLE_OLD
@ REF_VEHICLE_OLD
Load/save an old-style reference to a vehicle (for pre-4.4 savegames).
Definition: saveload.h:394
SLV_50
@ SLV_50
50 8973
Definition: saveload.h:103
SLV_17
@ SLV_17
17.0 3212 17.1 3218
Definition: saveload.h:62
SLV_SHIP_CURVE_PENALTY
@ SLV_SHIP_CURVE_PENALTY
209 PR#7289 Configurable ship curve penalties.
Definition: saveload.h:294
ChunkHandler::load_proc
ChunkSaveLoadProc * load_proc
Load procedure of the chunk.
Definition: saveload.h:382
SLV_145
@ SLV_145
145 20376
Definition: saveload.h:217
SLV_INDUSTRY_TEXT
@ SLV_INDUSTRY_TEXT
289 PR#8576 Additional GS text for industries.
Definition: saveload.h:326
SLV_170
@ SLV_170
170 23826
Definition: saveload.h:247
SLV_42
@ SLV_42
42 7573
Definition: saveload.h:93
DoExitSave
void DoExitSave()
Do a save when exiting the game (_settings_client.gui.autosave_on_exit)
Definition: saveload.cpp:2851
SLV_136
@ SLV_136
136 18764
Definition: saveload.h:206
SLV_28
@ SLV_28
28 4987
Definition: saveload.h:76
SLV_107
@ SLV_107
107 15027
Definition: saveload.h:171
SLV_64
@ SLV_64
64 10006
Definition: saveload.h:119
SLV_2
@ SLV_2
2.0 0.3.0 2.1 0.3.1, 0.3.2
Definition: saveload.h:34
SlIsObjectCurrentlyValid
static 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:842
SLV_142
@ SLV_142
142 20003
Definition: saveload.h:213
SLV_59
@ SLV_59
59 9779
Definition: saveload.h:113
SLV_12
@ SLV_12
12.1 2046
Definition: saveload.h:55
SLV_139
@ SLV_139
139 19346
Definition: saveload.h:209
SL_MAX_VERSION
@ SL_MAX_VERSION
Highest possible saveload version.
Definition: saveload.h:328
REF_LINK_GRAPH_JOB
@ REF_LINK_GRAPH_JOB
Load/save a reference to a link graph job.
Definition: saveload.h:401
SLV_8
@ SLV_8
8.0 1786
Definition: saveload.h:49
SGT_TTD
@ SGT_TTD
TTD savegame (can be detected incorrectly)
Definition: saveload.h:354
StringID
uint32 StringID
Numeric value that represents a string, independent of the selected language.
Definition: strings_type.h:16
SlErrorCorruptFmt
void NORETURN SlErrorCorruptFmt(const char *format,...)
Issue an SlErrorCorrupt with a format string.
Definition: saveload.cpp:370
SLV_33
@ SLV_33
33 6440
Definition: saveload.h:82
SLV_16
@ SLV_16
16.0 2817 16.1 3155
Definition: saveload.h:60
SLV_30
@ SLV_30
30 5946
Definition: saveload.h:79
REF_ORDERLIST
@ REF_ORDERLIST
Load/save a reference to an orderlist.
Definition: saveload.h:398
SLV_127
@ SLV_127
127 17439
Definition: saveload.h:195
DetailedFileType
DetailedFileType
Kinds of files in each AbstractFileType.
Definition: fileio_type.h:28
SLV_193
@ SLV_193
193 26802
Definition: saveload.h:275
SLV_189
@ SLV_189
189 26450 Hierarchical vehicle subgroups
Definition: saveload.h:269
SLV_47
@ SLV_47
47 8735
Definition: saveload.h:99
SLV_VEH_MOTION_COUNTER
@ SLV_VEH_MOTION_COUNTER
288 PR#8591 Desync safe motion counter
Definition: saveload.h:325
SLV_GS_INDUSTRY_CONTROL
@ SLV_GS_INDUSTRY_CONTROL
287 PR#7912 and PR#8115 GS industry control.
Definition: saveload.h:324
SLV_6
@ SLV_6
6.0 1721 6.1 1768
Definition: saveload.h:46
ChunkHandler::save_proc
ChunkSaveLoadProc * save_proc
Save procedure of the chunk.
Definition: saveload.h:381
VarTypes
VarTypes
VarTypes is the general bitmasked magic type that tells us certain characteristics about the variable...
Definition: saveload.h:421
SaveFilter
Interface for filtering a savegame till it is written.
Definition: saveload_filter.h:60
SLV_36
@ SLV_36
36 6624
Definition: saveload.h:86
GetVarMemType
static VarType GetVarMemType(VarType type)
Get the NumberType of a setting.
Definition: saveload.h:856
SLV_77
@ SLV_77
77 11172
Definition: saveload.h:135
SLV_91
@ SLV_91
91 12347
Definition: saveload.h:152
SLV_44
@ SLV_44
44 8144
Definition: saveload.h:95
SLV_197
@ SLV_197
197 27978 v1.8
Definition: saveload.h:280
SLV_24
@ SLV_24
24 4150
Definition: saveload.h:71
_sl_minor_version
byte _sl_minor_version
the minor savegame version, DO NOT USE!
Definition: saveload.cpp:66
SLV_81
@ SLV_81
81 11244
Definition: saveload.h:140
SLV_60
@ SLV_60
60 9874
Definition: saveload.h:115
SLV_89
@ SLV_89
89 12160
Definition: saveload.h:149
SLV_194
@ SLV_194
194 26881 v1.5
Definition: saveload.h:276
SL_LST
@ SL_LST
Save/load a list.
Definition: saveload.h:503
SLV_149
@ SLV_149
149 20832
Definition: saveload.h:221
SlReadByte
byte SlReadByte()
Wrapper for reading a byte from the buffer.
Definition: saveload.cpp:418
SLV_134
@ SLV_134
134 18703
Definition: saveload.h:203
SLV_122
@ SLV_122
122 16855
Definition: saveload.h:189
SLV_129
@ SLV_129
129 18292
Definition: saveload.h:197
SLV_184
@ SLV_184
184 25508 Unit localisation split
Definition: saveload.h:263
SLF_NOT_IN_CONFIG
@ SLF_NOT_IN_CONFIG
do not save to config file
Definition: saveload.h:487
SLV_38
@ SLV_38
38 7195
Definition: saveload.h:88
Subdirectory
Subdirectory
The different kinds of subdirectories OpenTTD uses.
Definition: fileio_type.h:108
SaveLoad::version_from
SaveLoadVersion version_from
save/load the variable starting from this savegame version
Definition: saveload.h:520
SLV_147
@ SLV_147
147 20621
Definition: saveload.h:219
SaveOrLoadResult
SaveOrLoadResult
Save or load result codes.
Definition: saveload.h:332
SLV_105
@ SLV_105
105 14803
Definition: saveload.h:169
SLV_165
@ SLV_165
165 23304
Definition: saveload.h:241
SLV_3
@ SLV_3
3.x lost
Definition: saveload.h:36
FiosType
FiosType
Elements of a file system that are recognized.
Definition: fileio_type.h:67
SLV_ENDING_YEAR
@ SLV_ENDING_YEAR
218 PR#7747 v1.10 Configurable ending year.
Definition: saveload.h:305
SLE_VAR_STRQ
@ SLE_VAR_STRQ
string pointer enclosed in quotes
Definition: saveload.h:449
SlCalcObjLength
size_t SlCalcObjLength(const void *object, const SaveLoad *sld)
Calculate the size of an object.
Definition: saveload.cpp:1436
ChunkType
ChunkType
Flags of a chunk.
Definition: saveload.h:405
SLV_148
@ SLV_148
148 20659
Definition: saveload.h:220
SlGetFieldLength
size_t SlGetFieldLength()
Get the length of the current object.
Definition: saveload.cpp:737
SLV_TRADING_AGE
@ SLV_TRADING_AGE
217 PR#7780 Configurable company trading age.
Definition: saveload.h:304
SLV_188
@ SLV_188
188 26169 v1.4 FS#5831 Unify RV travel time
Definition: saveload.h:268
SLV_99
@ SLV_99
99 13838
Definition: saveload.h:161
SLV_167
@ SLV_167
167 23504
Definition: saveload.h:243
SLV_68
@ SLV_68
68 10266
Definition: saveload.h:124
REF_LINK_GRAPH
@ REF_LINK_GRAPH
Load/save a reference to a link graph.
Definition: saveload.h:400
SLV_21
@ SLV_21
21 3472 0.4.x
Definition: saveload.h:68
SLV_97
@ SLV_97
97 13256
Definition: saveload.h:159
SLV_SHIP_PATH_CACHE
@ SLV_SHIP_PATH_CACHE
203 PR#7072 Add path cache for ships
Definition: saveload.h:287
LoadFilter
Interface for filtering a savegame till it is loaded.
Definition: saveload_filter.h:14
SLV_173
@ SLV_173
173 23967 1.2.0-RC1
Definition: saveload.h:250
SL_DEQUE
@ SL_DEQUE
Save/load a deque.
Definition: saveload.h:504
SLV_171
@ SLV_171
171 23835
Definition: saveload.h:248
SLV_185
@ SLV_185
185 25620 Storybooks
Definition: saveload.h:265
SLV_103
@ SLV_103
103 14598
Definition: saveload.h:166
SLV_80
@ SLV_80
80 11228
Definition: saveload.h:139
LoadWithFilter
SaveOrLoadResult LoadWithFilter(struct LoadFilter *reader)
Load the game using a (reader) filter.
Definition: saveload.cpp:2744
WriteValue
void WriteValue(void *ptr, VarType conv, int64 val)
Write the value of a setting.
Definition: saveload.cpp:773
SLV_180
@ SLV_180
180 24998 1.3.x
Definition: saveload.h:259
SLV_101
@ SLV_101
101 14233
Definition: saveload.h:164
SLV_195
@ SLV_195
195 27572 v1.6.1
Definition: saveload.h:278
SLV_19
@ SLV_19
19 3396
Definition: saveload.h:65
SLV_191
@ SLV_191
191 26636 FS#6026 Fix disaster vehicle storage (No bump) 191 26646 FS#6041 Linkgraph - store location...
Definition: saveload.h:272
SLV_58
@ SLV_58
58 9762
Definition: saveload.h:112
SLV_192
@ SLV_192
192 26700 FS#6066 Fix saving of order backups
Definition: saveload.h:274
SLV_70
@ SLV_70
70 10541
Definition: saveload.h:127
SaveWithFilter
SaveOrLoadResult SaveWithFilter(struct SaveFilter *writer, bool threaded)
Save the game using a (writer) filter.
Definition: saveload.cpp:2586
SL_ERROR
@ SL_ERROR
error that was caught before internal structures were modified
Definition: saveload.h:334
FileToSaveLoad::detail_ftype
DetailedFileType detail_ftype
Concrete file type (PNG, BMP, old save, etc).
Definition: saveload.h:341
SLV_92
@ SLV_92
92 12381 0.6.x
Definition: saveload.h:153
SLV_121
@ SLV_121
121 16694
Definition: saveload.h:188
SaveLoad::address_proc
SaveLoadAddrProc * address_proc
callback proc the get the actual variable address in memory
Definition: saveload.h:523
SLV_151
@ SLV_151
151 20918
Definition: saveload.h:224
SLV_75
@ SLV_75
75 11107
Definition: saveload.h:133
SLV_95
@ SLV_95
95 12924
Definition: saveload.h:157
SLV_110
@ SLV_110
110 15148
Definition: saveload.h:175
SaveloadCrashWithMissingNewGRFs
void NORETURN bool SaveloadCrashWithMissingNewGRFs()
Did loading the savegame cause a crash? If so, were NewGRFs missing?
Definition: afterload.cpp:364
SLV_START_PATCHPACKS
@ SLV_START_PATCHPACKS
220 First known patchpack to use a version just above ours.
Definition: saveload.h:321
SLV_4
@ SLV_4
4.0 1 4.1 122 0.3.3, 0.3.4 4.2 1222 0.3.5 4.3 1417 4.4 1426
Definition: saveload.h:37
FileToSaveLoad::SetMode
void SetMode(FiosType ft)
Set the mode and file type of the file to save or load based on the type of file entry at the file sy...
Definition: saveload.cpp:2894
SaveLoad
SaveLoad type struct.
Definition: saveload.h:516
SLV_153
@ SLV_153
153 21263
Definition: saveload.h:226
SLV_140
@ SLV_140
140 19382
Definition: saveload.h:211
SLV_26
@ SLV_26
26 4466
Definition: saveload.h:74
SLV_196
@ SLV_196
196 27778 v1.7
Definition: saveload.h:279
SLV_9
@ SLV_9
9.0 1909
Definition: saveload.h:50
GetVariableAddress
static void * GetVariableAddress(const void *object, const SaveLoad *sld)
Get the address of the variable.
Definition: saveload.h:887
SL_OK
@ SL_OK
completed successfully
Definition: saveload.h:333
SL_STDSTR
@ SL_STDSTR
Save/load a std::string.
Definition: saveload.h:505
SLV_51
@ SLV_51
51 8978
Definition: saveload.h:104
SLV_63
@ SLV_63
63 9956
Definition: saveload.h:118
SGT_TTDP2
@ SGT_TTDP2
TTDP savegame in new format (data at SE border)
Definition: saveload.h:356
SlSkipBytes
static 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:930
_sl_version
SaveLoadVersion _sl_version
the major savegame version identifier
Definition: saveload.cpp:65
SLE_VAR_NAME
@ SLE_VAR_NAME
old custom name to be converted to a char pointer
Definition: saveload.h:450
SLV_137
@ SLV_137
137 18912
Definition: saveload.h:207
SLV_143
@ SLV_143
143 20048
Definition: saveload.h:214
SLV_34
@ SLV_34
34 6455
Definition: saveload.h:83
SLV_57
@ SLV_57
57 9691
Definition: saveload.h:111
SLV_72
@ SLV_72
72 10601
Definition: saveload.h:129
SLV_152
@ SLV_152
152 21171
Definition: saveload.h:225
SLV_37
@ SLV_37
37 7182
Definition: saveload.h:87
SLV_1
@ SLV_1
1.0 0.1.x, 0.2.x
Definition: saveload.h:33
SlError
void NORETURN SlError(StringID string, const char *extra_msg=nullptr)
Error handler.
Definition: saveload.cpp:326
SLV_13
@ SLV_13
13.1 2080 0.4.0, 0.4.0.1
Definition: saveload.h:56
SLV_190
@ SLV_190
190 26547 Separate order travel and wait times
Definition: saveload.h:271
FileToSaveLoad::file_op
SaveLoadOperation file_op
File operation to perform.
Definition: saveload.h:340
SLV_SHIP_ROTATION
@ SLV_SHIP_ROTATION
204 PR#7065 Add extra rotation stages for ships.
Definition: saveload.h:288
SLV_39
@ SLV_39
39 7269
Definition: saveload.h:89
SLV_48
@ SLV_48
48 8935
Definition: saveload.h:100
SLV_159
@ SLV_159
159 21962
Definition: saveload.h:233
SLV_18
@ SLV_18
18 3227
Definition: saveload.h:64
SLV_177
@ SLV_177
177 24619
Definition: saveload.h:255
SLV_EXTEND_RAILTYPES
@ SLV_EXTEND_RAILTYPES
200 PR#6805 Extend railtypes to 64, adding uint16 to map array.
Definition: saveload.h:284
SLV_71
@ SLV_71
71 10567
Definition: saveload.h:128
ReadValue
int64 ReadValue(const void *ptr, VarType conv)
Return a signed-long version of the value of a setting.
Definition: saveload.cpp:749