OpenTTD Source 20241224-master-gf74b0cf984
|
Functions/types related to saving and loading games. More...
Go to the source code of this file.
Data Structures | |
struct | FileToSaveLoad |
Deals with the type of the savegame, independent of extension. More... | |
struct | ChunkHandler |
Handlers and description of chunk. More... | |
class | SaveLoadHandler |
Handler for saving/loading an object to/from disk. More... | |
class | DefaultSaveLoadHandler< TImpl, TObject > |
Default handler for saving/loading an object to/from disk. More... | |
struct | SaveLoad |
SaveLoad type struct. More... | |
struct | SaveLoadCompat |
SaveLoad information for backwards compatibility. More... | |
class | VectorSaveLoadHandler< TImpl, TObject, TElementType, MAX_LENGTH > |
Default handler for saving/loading a vector to/from disk. More... | |
Macros | |
#define | SLE_GENERAL_NAME(cmd, name, base, variable, type, length, from, to, extra) |
Storage of simple variables, references (pointers), and arrays. | |
#define | SLE_GENERAL(cmd, base, variable, type, length, from, to, extra) SLE_GENERAL_NAME(cmd, #variable, base, variable, type, length, from, to, extra) |
Storage of simple variables, references (pointers), and arrays with a custom name. | |
#define | SLE_CONDVAR(base, variable, type, from, to) SLE_GENERAL(SL_VAR, base, variable, type, 0, from, to, 0) |
Storage of a variable in some savegame versions. | |
#define | SLE_CONDVARNAME(base, variable, name, type, from, to) SLE_GENERAL_NAME(SL_VAR, name, base, variable, type, 0, from, to, 0) |
Storage of a variable in some savegame versions. | |
#define | SLE_CONDREF(base, variable, type, from, to) SLE_GENERAL(SL_REF, base, variable, type, 0, from, to, 0) |
Storage of a reference in some savegame versions. | |
#define | SLE_CONDARR(base, variable, type, length, from, to) SLE_GENERAL(SL_ARR, base, variable, type, length, from, to, 0) |
Storage of a fixed-size array of SL_VAR elements in some savegame versions. | |
#define | SLE_CONDARRNAME(base, variable, name, type, length, from, to) SLE_GENERAL_NAME(SL_ARR, name, base, variable, type, length, from, to, 0) |
Storage of a fixed-size array of SL_VAR elements in some savegame versions. | |
#define | SLE_CONDSTR(base, variable, type, length, from, to) SLE_GENERAL(SL_STR, base, variable, type, length, from, to, 0) |
Storage of a string in some savegame versions. | |
#define | SLE_CONDSSTR(base, variable, type, from, to) SLE_GENERAL(SL_STDSTR, base, variable, type, 0, from, to, 0) |
Storage of a std::string in some savegame versions. | |
#define | SLE_CONDSSTRNAME(base, variable, name, type, from, to) SLE_GENERAL_NAME(SL_STDSTR, name, base, variable, type, 0, from, to, 0) |
Storage of a std::string in some savegame versions. | |
#define | SLE_CONDREFLIST(base, variable, type, from, to) SLE_GENERAL(SL_REFLIST, base, variable, type, 0, from, to, 0) |
Storage of a list of SL_REF elements in some savegame versions. | |
#define | SLE_CONDREFVECTOR(base, variable, type, from, to) SLE_GENERAL(SL_REFVECTOR, base, variable, type, 0, from, to, 0) |
Storage of a vector of SL_REF elements in some savegame versions. | |
#define | SLE_CONDVECTOR(base, variable, type, from, to) SLE_GENERAL(SL_VECTOR, base, variable, type, 0, from, to, 0) |
Storage of a vector of SL_VAR elements in some savegame versions. | |
#define | SLE_CONDDEQUE(base, variable, type, from, to) SLE_GENERAL(SL_DEQUE, base, variable, type, 0, from, to, 0) |
Storage of a deque of SL_VAR elements in some savegame versions. | |
#define | SLE_CONDVECTOR(base, variable, type, from, to) SLE_GENERAL(SL_VECTOR, base, variable, type, 0, from, to, 0) |
Storage of a vector of SL_VAR elements in some savegame versions. | |
#define | SLE_VAR(base, variable, type) SLE_CONDVAR(base, variable, type, SL_MIN_VERSION, SL_MAX_VERSION) |
Storage of a variable in every version of a savegame. | |
#define | SLE_VARNAME(base, variable, name, type) SLE_CONDVARNAME(base, variable, name, type, SL_MIN_VERSION, SL_MAX_VERSION) |
Storage of a variable in every version of a savegame. | |
#define | SLE_REF(base, variable, type) SLE_CONDREF(base, variable, type, SL_MIN_VERSION, SL_MAX_VERSION) |
Storage of a reference in every version of a savegame. | |
#define | SLE_ARR(base, variable, type, length) SLE_CONDARR(base, variable, type, length, SL_MIN_VERSION, SL_MAX_VERSION) |
Storage of fixed-size array of SL_VAR elements in every version of a savegame. | |
#define | SLE_ARRNAME(base, variable, name, type, length) SLE_CONDARRNAME(base, variable, name, type, length, SL_MIN_VERSION, SL_MAX_VERSION) |
Storage of fixed-size array of SL_VAR elements in every version of a savegame. | |
#define | SLE_SSTR(base, variable, type) SLE_CONDSSTR(base, variable, type, SL_MIN_VERSION, SL_MAX_VERSION) |
Storage of a std::string in every savegame version. | |
#define | SLE_SSTRNAME(base, variable, name, type) SLE_CONDSSTRNAME(base, variable, name, type, SL_MIN_VERSION, SL_MAX_VERSION) |
Storage of a std::string in every savegame version. | |
#define | SLE_REFLIST(base, variable, type) SLE_CONDREFLIST(base, variable, type, SL_MIN_VERSION, SL_MAX_VERSION) |
Storage of a list of SL_REF elements in every savegame version. | |
#define | SLE_REFVECTOR(base, variable, type) SLE_CONDREFVECTOR(base, variable, type, SL_MIN_VERSION, SL_MAX_VERSION) |
Storage of a vector of SL_REF elements in every savegame version. | |
#define | SLE_SAVEBYTE(base, variable) SLE_GENERAL(SL_SAVEBYTE, base, variable, 0, 0, SL_MIN_VERSION, SL_MAX_VERSION, 0) |
Only write byte during saving; never read it during loading. | |
#define | SLEG_GENERAL(name, cmd, variable, type, length, from, to, extra) |
Storage of global simple variables, references (pointers), and arrays. | |
#define | SLEG_CONDVAR(name, variable, type, from, to) SLEG_GENERAL(name, SL_VAR, variable, type, 0, from, to, 0) |
Storage of a global variable in some savegame versions. | |
#define | SLEG_CONDREF(name, variable, type, from, to) SLEG_GENERAL(name, SL_REF, variable, type, 0, from, to, 0) |
Storage of a global reference in some savegame versions. | |
#define | SLEG_CONDARR(name, variable, type, length, from, to) SLEG_GENERAL(name, SL_ARR, variable, type, length, from, to, 0) |
Storage of a global fixed-size array of SL_VAR elements in some savegame versions. | |
#define | SLEG_CONDSSTR(name, variable, type, from, to) SLEG_GENERAL(name, SL_STDSTR, variable, type, 0, from, to, 0) |
Storage of a global std::string in some savegame versions. | |
#define | SLEG_CONDSTRUCT(name, handler, from, to) SaveLoad {name, SL_STRUCT, 0, 0, from, to, nullptr, 0, std::make_shared<handler>()} |
Storage of a structs in some savegame versions. | |
#define | SLEG_CONDREFLIST(name, variable, type, from, to) SLEG_GENERAL(name, SL_REFLIST, variable, type, 0, from, to, 0) |
Storage of a global reference list in some savegame versions. | |
#define | SLEG_CONDVECTOR(name, variable, type, from, to) SLEG_GENERAL(name, SL_VECTOR, variable, type, 0, from, to, 0) |
Storage of a global vector of SL_VAR elements in some savegame versions. | |
#define | SLEG_CONDSTRUCTLIST(name, handler, from, to) SaveLoad {name, SL_STRUCTLIST, 0, 0, from, to, nullptr, 0, std::make_shared<handler>()} |
Storage of a list of structs in some savegame versions. | |
#define | SLEG_VAR(name, variable, type) SLEG_CONDVAR(name, variable, type, SL_MIN_VERSION, SL_MAX_VERSION) |
Storage of a global variable in every savegame version. | |
#define | SLEG_REF(name, variable, type) SLEG_CONDREF(name, variable, type, SL_MIN_VERSION, SL_MAX_VERSION) |
Storage of a global reference in every savegame version. | |
#define | SLEG_ARR(name, variable, type, length) SLEG_CONDARR(name, variable, type, length, SL_MIN_VERSION, SL_MAX_VERSION) |
Storage of a global fixed-size array of SL_VAR elements in every savegame version. | |
#define | SLEG_SSTR(name, variable, type) SLEG_CONDSSTR(name, variable, type, SL_MIN_VERSION, SL_MAX_VERSION) |
Storage of a global std::string in every savegame version. | |
#define | SLEG_STRUCT(name, handler) SLEG_CONDSTRUCT(name, handler, SL_MIN_VERSION, SL_MAX_VERSION) |
Storage of a structs in every savegame version. | |
#define | SLEG_REFLIST(name, variable, type) SLEG_CONDREFLIST(name, variable, type, SL_MIN_VERSION, SL_MAX_VERSION) |
Storage of a global reference list in every savegame version. | |
#define | SLEG_VECTOR(name, variable, type) SLEG_CONDVECTOR(name, variable, type, SL_MIN_VERSION, SL_MAX_VERSION) |
Storage of a global vector of SL_VAR elements in every savegame version. | |
#define | SLEG_STRUCTLIST(name, handler) SLEG_CONDSTRUCTLIST(name, handler, SL_MIN_VERSION, SL_MAX_VERSION) |
Storage of a list of structs in every savegame version. | |
#define | SLC_VAR(name) {name, SLE_FILE_U8, 0, SL_MIN_VERSION, SL_MAX_VERSION} |
Field name where the real SaveLoad can be located. | |
#define | SLC_NULL(length, from, to) {{}, SLE_FILE_U8, length, from, to} |
Empty space in every savegame version. | |
Typedefs | |
typedef void | AutolengthProc(int) |
using | ChunkHandlerRef = std::reference_wrapper< const ChunkHandler > |
A reference to ChunkHandler. | |
using | ChunkHandlerTable = std::span< const ChunkHandlerRef > |
A table of ChunkHandler entries. | |
using | SaveLoadTable = std::span< const struct SaveLoad > |
A table of SaveLoad entries. | |
using | SaveLoadCompatTable = std::span< const struct SaveLoadCompat > |
A table of SaveLoadCompat entries. | |
typedef uint32_t | VarType |
typedef void * | SaveLoadAddrProc(void *base, size_t extra) |
Functions | |
std::string | GenerateDefaultSaveName () |
Get the default name for a savegame or screenshot. | |
void | SetSaveLoadError (StringID str) |
Set the error message from outside of the actual loading/saving of the game (AfterLoadGame and friends) | |
StringID | GetSaveLoadErrorType () |
Return the appropriate initial string for an error depending on whether we are saving or loading. | |
StringID | GetSaveLoadErrorMessage () |
Return the description of the error. | |
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. | |
void | WaitTillSaved () |
void | ProcessAsyncSaveFinish () |
Handle async save finishes. | |
void | DoExitSave () |
Do a save when exiting the game (_settings_client.gui.autosave_on_exit) | |
void | DoAutoOrNetsave (FiosNumberedSaveName &counter) |
Create an autosave or netsave. | |
SaveOrLoadResult | SaveWithFilter (std::shared_ptr< struct SaveFilter > writer, bool threaded) |
SaveOrLoadResult | LoadWithFilter (std::shared_ptr< struct LoadFilter > reader) |
constexpr VarType | GetVarMemType (VarType type) |
Get the NumberType of a setting. | |
constexpr VarType | GetVarFileType (VarType type) |
Get the FileType of a setting. | |
constexpr bool | IsNumericType (VarType conv) |
Check if the given saveload type is a numeric type. | |
constexpr size_t | SlVarSize (VarType type) |
Return expect size in bytes of a VarType. | |
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. | |
bool | IsSavegameVersionBefore (SaveLoadVersion major, uint8_t minor=0) |
Checks whether the savegame is below major. | |
bool | IsSavegameVersionBeforeOrAt (SaveLoadVersion major) |
Checks whether the savegame is below or at major. | |
bool | SlIsObjectCurrentlyValid (SaveLoadVersion version_from, SaveLoadVersion version_to) |
Checks if some version from/to combination falls within the range of the active savegame version. | |
void * | GetVariableAddress (const void *object, const SaveLoad &sld) |
Get the address of the variable. | |
int64_t | ReadValue (const void *ptr, VarType conv) |
Return a signed-long version of the value of a setting. | |
void | WriteValue (void *ptr, VarType conv, int64_t val) |
Write the value of a setting. | |
void | SlSetArrayIndex (uint index) |
int | SlIterateArray () |
Iterate through the elements of an array and read the whole thing. | |
void | SlSetStructListLength (size_t length) |
Set the length of this list. | |
size_t | SlGetStructListLength (size_t limit) |
Get the length of this list; if it exceeds the limit, error out. | |
void | SlAutolength (AutolengthProc *proc, int arg) |
Do something of which I have no idea what it is :P. | |
size_t | SlGetFieldLength () |
Get the length of the current object. | |
void | SlSetLength (size_t length) |
Sets the length of either a RIFF object or the number of items in an array. | |
size_t | SlCalcObjMemberLength (const void *object, const SaveLoad &sld) |
size_t | SlCalcObjLength (const void *object, const SaveLoadTable &slt) |
Calculate the size of an object. | |
uint8_t | SlReadByte () |
Wrapper for reading a byte from the buffer. | |
void | SlWriteByte (uint8_t b) |
Wrapper for writing a byte to the dumper. | |
void | SlGlobList (const SaveLoadTable &slt) |
Save or Load (a list of) global variables. | |
void | SlCopy (void *object, size_t length, VarType conv) |
Copy a list of SL_VARs to/from a savegame. | |
std::vector< SaveLoad > | SlTableHeader (const SaveLoadTable &slt) |
Save or Load a table header. | |
std::vector< SaveLoad > | SlCompatTableHeader (const SaveLoadTable &slt, const SaveLoadCompatTable &slct) |
Load a table header in a savegame compatible way. | |
void | SlObject (void *object, const SaveLoadTable &slt) |
Main SaveLoad function. | |
bool | SaveloadCrashWithMissingNewGRFs () |
Did loading the savegame cause a crash? If so, were NewGRFs missing? | |
void | SlSkipBytes (size_t length) |
Read in bytes from the file/data structure but don't do anything with them, discarding them in effect. | |
Variables | |
FileToSaveLoad | _file_to_saveload |
File to save or load in the openttd loop. | |
std::string | _savegame_format |
how to compress savegames | |
bool | _do_autosave |
are we doing an autosave at the moment? | |
Functions/types related to saving and loading games.
Functions/types related to errors from savegames.
Definition in file saveload.h.
#define SLC_NULL | ( | length, | |
from, | |||
to | |||
) | {{}, SLE_FILE_U8, length, from, to} |
Empty space in every savegame version.
length | Length of the empty space in bytes. |
from | First savegame version that has the empty space. |
to | Last savegame version that has the empty space. |
Definition at line 1255 of file saveload.h.
#define SLC_VAR | ( | name | ) | {name, SLE_FILE_U8, 0, SL_MIN_VERSION, SL_MAX_VERSION} |
Field name where the real SaveLoad can be located.
name | The name of the field. |
Definition at line 1247 of file saveload.h.
#define SLE_ARR | ( | base, | |
variable, | |||
type, | |||
length | |||
) | SLE_CONDARR(base, variable, type, length, SL_MIN_VERSION, SL_MAX_VERSION) |
Storage of fixed-size array of SL_VAR elements in every version of a savegame.
base | Name of the class or struct containing the array. |
variable | Name of the variable in the class or struct referenced by base. |
type | Storage of the data in memory and in the savegame. |
length | Number of elements in the array. |
Definition at line 1028 of file saveload.h.
#define SLE_ARRNAME | ( | base, | |
variable, | |||
name, | |||
type, | |||
length | |||
) | SLE_CONDARRNAME(base, variable, name, type, length, SL_MIN_VERSION, SL_MAX_VERSION) |
Storage of fixed-size array of SL_VAR elements in every version of a savegame.
base | Name of the class or struct containing the array. |
variable | Name of the variable in the class or struct referenced by base. |
name | Field name for table chunks. |
type | Storage of the data in memory and in the savegame. |
length | Number of elements in the array. |
Definition at line 1038 of file saveload.h.
#define SLE_CONDARR | ( | base, | |
variable, | |||
type, | |||
length, | |||
from, | |||
to | |||
) | SLE_GENERAL(SL_ARR, base, variable, type, length, from, to, 0) |
Storage of a fixed-size array of SL_VAR elements in some savegame versions.
base | Name of the class or struct containing the array. |
variable | Name of the variable in the class or struct referenced by base. |
type | Storage of the data in memory and in the savegame. |
length | Number of elements in the array. |
from | First savegame version that has the array. |
to | Last savegame version that has the array. |
Definition at line 900 of file saveload.h.
#define SLE_CONDARRNAME | ( | base, | |
variable, | |||
name, | |||
type, | |||
length, | |||
from, | |||
to | |||
) | SLE_GENERAL_NAME(SL_ARR, name, base, variable, type, length, from, to, 0) |
Storage of a fixed-size array of SL_VAR elements in some savegame versions.
base | Name of the class or struct containing the array. |
variable | Name of the variable in the class or struct referenced by base. |
name | Field name for table chunks. |
type | Storage of the data in memory and in the savegame. |
length | Number of elements in the array. |
from | First savegame version that has the array. |
to | Last savegame version that has the array. |
Definition at line 912 of file saveload.h.
#define SLE_CONDDEQUE | ( | base, | |
variable, | |||
type, | |||
from, | |||
to | |||
) | SLE_GENERAL(SL_DEQUE, base, variable, type, 0, from, to, 0) |
Storage of a deque of SL_VAR elements in some savegame versions.
base | Name of the class or struct containing the list. |
variable | Name of the variable in the class or struct referenced by base. |
type | Storage of the data in memory and in the savegame. |
from | First savegame version that has the list. |
to | Last savegame version that has the list. |
Definition at line 984 of file saveload.h.
#define SLE_CONDREF | ( | base, | |
variable, | |||
type, | |||
from, | |||
to | |||
) | SLE_GENERAL(SL_REF, base, variable, type, 0, from, to, 0) |
Storage of a reference in some savegame versions.
base | Name of the class or struct containing the variable. |
variable | Name of the variable in the class or struct referenced by base. |
type | Type of the reference, a value from SLRefType. |
from | First savegame version that has the field. |
to | Last savegame version that has the field. |
Definition at line 889 of file saveload.h.
#define SLE_CONDREFLIST | ( | base, | |
variable, | |||
type, | |||
from, | |||
to | |||
) | SLE_GENERAL(SL_REFLIST, base, variable, type, 0, from, to, 0) |
Storage of a list of SL_REF elements in some savegame versions.
base | Name of the class or struct containing the list. |
variable | Name of the variable in the class or struct referenced by base. |
type | Storage of the data in memory and in the savegame. |
from | First savegame version that has the list. |
to | Last savegame version that has the list. |
Definition at line 954 of file saveload.h.
#define SLE_CONDREFVECTOR | ( | base, | |
variable, | |||
type, | |||
from, | |||
to | |||
) | SLE_GENERAL(SL_REFVECTOR, base, variable, type, 0, from, to, 0) |
Storage of a vector of SL_REF elements in some savegame versions.
base | Name of the class or struct containing the vector. |
variable | Name of the variable in the class or struct referenced by base. |
type | Storage of the data in memory and in the savegame. |
from | First savegame version that has the vector. |
to | Last savegame version that has the vector. |
Definition at line 964 of file saveload.h.
#define SLE_CONDSSTR | ( | base, | |
variable, | |||
type, | |||
from, | |||
to | |||
) | SLE_GENERAL(SL_STDSTR, base, variable, type, 0, from, to, 0) |
Storage of a std::string
in some savegame versions.
base | Name of the class or struct containing the string. |
variable | Name of the variable in the class or struct referenced by base. |
type | Storage of the data in memory and in the savegame. |
from | First savegame version that has the string. |
to | Last savegame version that has the string. |
Definition at line 933 of file saveload.h.
#define SLE_CONDSSTRNAME | ( | base, | |
variable, | |||
name, | |||
type, | |||
from, | |||
to | |||
) | SLE_GENERAL_NAME(SL_STDSTR, name, base, variable, type, 0, from, to, 0) |
Storage of a std::string
in some savegame versions.
base | Name of the class or struct containing the string. |
variable | Name of the variable in the class or struct referenced by base. |
name | Field name for table chunks. |
type | Storage of the data in memory and in the savegame. |
from | First savegame version that has the string. |
to | Last savegame version that has the string. |
Definition at line 944 of file saveload.h.
#define SLE_CONDSTR | ( | base, | |
variable, | |||
type, | |||
length, | |||
from, | |||
to | |||
) | SLE_GENERAL(SL_STR, base, variable, type, length, from, to, 0) |
Storage of a string in some savegame versions.
base | Name of the class or struct containing the string. |
variable | Name of the variable in the class or struct referenced by base. |
type | Storage of the data in memory and in the savegame. |
length | Number of elements in the string (only used for fixed size buffers). |
from | First savegame version that has the string. |
to | Last savegame version that has the string. |
Definition at line 923 of file saveload.h.
#define SLE_CONDVAR | ( | base, | |
variable, | |||
type, | |||
from, | |||
to | |||
) | SLE_GENERAL(SL_VAR, base, variable, type, 0, from, to, 0) |
Storage of a variable in some savegame versions.
base | Name of the class or struct containing the variable. |
variable | Name of the variable in the class or struct referenced by base. |
type | Storage of the data in memory and in the savegame. |
from | First savegame version that has the field. |
to | Last savegame version that has the field. |
Definition at line 868 of file saveload.h.
#define SLE_CONDVARNAME | ( | base, | |
variable, | |||
name, | |||
type, | |||
from, | |||
to | |||
) | SLE_GENERAL_NAME(SL_VAR, name, base, variable, type, 0, from, to, 0) |
Storage of a variable in some savegame versions.
base | Name of the class or struct containing the variable. |
variable | Name of the variable in the class or struct referenced by base. |
name | Field name for table chunks. |
type | Storage of the data in memory and in the savegame. |
from | First savegame version that has the field. |
to | Last savegame version that has the field. |
Definition at line 879 of file saveload.h.
#define SLE_CONDVECTOR | ( | base, | |
variable, | |||
type, | |||
from, | |||
to | |||
) | SLE_GENERAL(SL_VECTOR, base, variable, type, 0, from, to, 0) |
Storage of a vector of SL_VAR elements in some savegame versions.
base | Name of the class or struct containing the list. |
variable | Name of the variable in the class or struct referenced by base. |
type | Storage of the data in memory and in the savegame. |
from | First savegame version that has the list. |
to | Last savegame version that has the list. |
Definition at line 974 of file saveload.h.
#define SLE_CONDVECTOR | ( | base, | |
variable, | |||
type, | |||
from, | |||
to | |||
) | SLE_GENERAL(SL_VECTOR, base, variable, type, 0, from, to, 0) |
Storage of a vector of SL_VAR elements in some savegame versions.
base | Name of the class or struct containing the list. |
variable | Name of the variable in the class or struct referenced by base. |
type | Storage of the data in memory and in the savegame. |
from | First savegame version that has the list. |
to | Last savegame version that has the list. |
Definition at line 974 of file saveload.h.
#define SLE_GENERAL | ( | cmd, | |
base, | |||
variable, | |||
type, | |||
length, | |||
from, | |||
to, | |||
extra | |||
) | SLE_GENERAL_NAME(cmd, #variable, base, variable, type, length, from, to, extra) |
Storage of simple variables, references (pointers), and arrays with a custom name.
cmd | Load/save type. |
base | Name of the class or struct containing the variable. |
variable | Name of the variable in the class or struct referenced by base. |
type | Storage of the data in memory and in the savegame. |
length | Number of elements in the array. |
from | First savegame version that has the field. |
to | Last savegame version that has the field. |
extra | Extra data to pass to the address callback function. |
Definition at line 858 of file saveload.h.
#define SLE_GENERAL_NAME | ( | cmd, | |
name, | |||
base, | |||
variable, | |||
type, | |||
length, | |||
from, | |||
to, | |||
extra | |||
) |
Storage of simple variables, references (pointers), and arrays.
cmd | Load/save type. |
name | Field name for table chunks. |
base | Name of the class or struct containing the variable. |
variable | Name of the variable in the class or struct referenced by base. |
type | Storage of the data in memory and in the savegame. |
length | Number of elements in the array. |
from | First savegame version that has the field. |
to | Last savegame version that has the field. |
extra | Extra data to pass to the address callback function. |
Definition at line 839 of file saveload.h.
#define SLE_REF | ( | base, | |
variable, | |||
type | |||
) | SLE_CONDREF(base, variable, type, SL_MIN_VERSION, SL_MAX_VERSION) |
Storage of a reference in every version of a savegame.
base | Name of the class or struct containing the variable. |
variable | Name of the variable in the class or struct referenced by base. |
type | Type of the reference, a value from SLRefType. |
Definition at line 1019 of file saveload.h.
#define SLE_REFLIST | ( | base, | |
variable, | |||
type | |||
) | SLE_CONDREFLIST(base, variable, type, SL_MIN_VERSION, SL_MAX_VERSION) |
Storage of a list of SL_REF elements in every savegame version.
base | Name of the class or struct containing the list. |
variable | Name of the variable in the class or struct referenced by base. |
type | Storage of the data in memory and in the savegame. |
Definition at line 1063 of file saveload.h.
#define SLE_REFVECTOR | ( | base, | |
variable, | |||
type | |||
) | SLE_CONDREFVECTOR(base, variable, type, SL_MIN_VERSION, SL_MAX_VERSION) |
Storage of a vector of SL_REF elements in every savegame version.
base | Name of the class or struct containing the vector. |
variable | Name of the variable in the class or struct referenced by base. |
type | Storage of the data in memory and in the savegame. |
Definition at line 1071 of file saveload.h.
#define SLE_SAVEBYTE | ( | base, | |
variable | |||
) | SLE_GENERAL(SL_SAVEBYTE, base, variable, 0, 0, SL_MIN_VERSION, SL_MAX_VERSION, 0) |
Only write byte during saving; never read it during loading.
When using SLE_SAVEBYTE you will have to read this byte before the table this is in is read. This also means SLE_SAVEBYTE can only be used at the top of a chunk. This is intended to be used to indicate what type of entry this is in a list of entries.
base | Name of the class or struct containing the variable. |
variable | Name of the variable in the class or struct referenced by base. |
Definition at line 1083 of file saveload.h.
#define SLE_SSTR | ( | base, | |
variable, | |||
type | |||
) | SLE_CONDSSTR(base, variable, type, SL_MIN_VERSION, SL_MAX_VERSION) |
Storage of a std::string
in every savegame version.
base | Name of the class or struct containing the string. |
variable | Name of the variable in the class or struct referenced by base. |
type | Storage of the data in memory and in the savegame. |
Definition at line 1046 of file saveload.h.
#define SLE_SSTRNAME | ( | base, | |
variable, | |||
name, | |||
type | |||
) | SLE_CONDSSTRNAME(base, variable, name, type, SL_MIN_VERSION, SL_MAX_VERSION) |
Storage of a std::string
in every savegame version.
base | Name of the class or struct containing the string. |
variable | Name of the variable in the class or struct referenced by base. |
name | Field name for table chunks. |
type | Storage of the data in memory and in the savegame. |
Definition at line 1055 of file saveload.h.
#define SLE_VAR | ( | base, | |
variable, | |||
type | |||
) | SLE_CONDVAR(base, variable, type, SL_MIN_VERSION, SL_MAX_VERSION) |
Storage of a variable in every version of a savegame.
base | Name of the class or struct containing the variable. |
variable | Name of the variable in the class or struct referenced by base. |
type | Storage of the data in memory and in the savegame. |
Definition at line 1002 of file saveload.h.
#define SLE_VARNAME | ( | base, | |
variable, | |||
name, | |||
type | |||
) | SLE_CONDVARNAME(base, variable, name, type, SL_MIN_VERSION, SL_MAX_VERSION) |
Storage of a variable in every version of a savegame.
base | Name of the class or struct containing the variable. |
variable | Name of the variable in the class or struct referenced by base. |
name | Field name for table chunks. |
type | Storage of the data in memory and in the savegame. |
Definition at line 1011 of file saveload.h.
#define SLEG_ARR | ( | name, | |
variable, | |||
type, | |||
length | |||
) | SLEG_CONDARR(name, variable, type, length, SL_MIN_VERSION, SL_MAX_VERSION) |
Storage of a global fixed-size array of SL_VAR elements in every savegame version.
name | The name of the field. |
variable | Name of the global variable. |
type | Storage of the data in memory and in the savegame. |
length | Number of elements in the array. |
Definition at line 1203 of file saveload.h.
#define SLEG_CONDARR | ( | name, | |
variable, | |||
type, | |||
length, | |||
from, | |||
to | |||
) | SLEG_GENERAL(name, SL_ARR, variable, type, length, from, to, 0) |
Storage of a global fixed-size array of SL_VAR elements in some savegame versions.
name | The name of the field. |
variable | Name of the global variable. |
type | Storage of the data in memory and in the savegame. |
length | Number of elements in the array. |
from | First savegame version that has the array. |
to | Last savegame version that has the array. |
Definition at line 1130 of file saveload.h.
#define SLEG_CONDREF | ( | name, | |
variable, | |||
type, | |||
from, | |||
to | |||
) | SLEG_GENERAL(name, SL_REF, variable, type, 0, from, to, 0) |
Storage of a global reference in some savegame versions.
name | The name of the field. |
variable | Name of the global variable. |
type | Storage of the data in memory and in the savegame. |
from | First savegame version that has the field. |
to | Last savegame version that has the field. |
Definition at line 1119 of file saveload.h.
#define SLEG_CONDREFLIST | ( | name, | |
variable, | |||
type, | |||
from, | |||
to | |||
) | SLEG_GENERAL(name, SL_REFLIST, variable, type, 0, from, to, 0) |
Storage of a global reference list in some savegame versions.
name | The name of the field. |
variable | Name of the global variable. |
type | Storage of the data in memory and in the savegame. |
from | First savegame version that has the list. |
to | Last savegame version that has the list. |
Definition at line 1159 of file saveload.h.
#define SLEG_CONDSSTR | ( | name, | |
variable, | |||
type, | |||
from, | |||
to | |||
) | SLEG_GENERAL(name, SL_STDSTR, variable, type, 0, from, to, 0) |
Storage of a global std::string
in some savegame versions.
name | The name of the field. |
variable | Name of the global variable. |
type | Storage of the data in memory and in the savegame. |
from | First savegame version that has the string. |
to | Last savegame version that has the string. |
Definition at line 1140 of file saveload.h.
#define SLEG_CONDSTRUCT | ( | name, | |
handler, | |||
from, | |||
to | |||
) | SaveLoad {name, SL_STRUCT, 0, 0, from, to, nullptr, 0, std::make_shared<handler>()} |
Storage of a structs in some savegame versions.
name | The name of the field. |
handler | SaveLoadHandler for the structs. |
from | First savegame version that has the struct. |
to | Last savegame version that has the struct. |
Definition at line 1149 of file saveload.h.
#define SLEG_CONDSTRUCTLIST | ( | name, | |
handler, | |||
from, | |||
to | |||
) | SaveLoad {name, SL_STRUCTLIST, 0, 0, from, to, nullptr, 0, std::make_shared<handler>()} |
Storage of a list of structs in some savegame versions.
name | The name of the field. |
handler | SaveLoadHandler for the list of structs. |
from | First savegame version that has the list. |
to | Last savegame version that has the list. |
Definition at line 1178 of file saveload.h.
#define SLEG_CONDVAR | ( | name, | |
variable, | |||
type, | |||
from, | |||
to | |||
) | SLEG_GENERAL(name, SL_VAR, variable, type, 0, from, to, 0) |
Storage of a global variable in some savegame versions.
name | The name of the field. |
variable | Name of the global variable. |
type | Storage of the data in memory and in the savegame. |
from | First savegame version that has the field. |
to | Last savegame version that has the field. |
Definition at line 1109 of file saveload.h.
#define SLEG_CONDVECTOR | ( | name, | |
variable, | |||
type, | |||
from, | |||
to | |||
) | SLEG_GENERAL(name, SL_VECTOR, variable, type, 0, from, to, 0) |
Storage of a global vector of SL_VAR elements in some savegame versions.
name | The name of the field. |
variable | Name of the global variable. |
type | Storage of the data in memory and in the savegame. |
from | First savegame version that has the list. |
to | Last savegame version that has the list. |
Definition at line 1169 of file saveload.h.
#define SLEG_GENERAL | ( | name, | |
cmd, | |||
variable, | |||
type, | |||
length, | |||
from, | |||
to, | |||
extra | |||
) |
Storage of global simple variables, references (pointers), and arrays.
name | The name of the field. |
cmd | Load/save type. |
variable | Name of the global variable. |
type | Storage of the data in memory and in the savegame. |
from | First savegame version that has the field. |
to | Last savegame version that has the field. |
extra | Extra data to pass to the address callback function. |
Definition at line 1096 of file saveload.h.
#define SLEG_REF | ( | name, | |
variable, | |||
type | |||
) | SLEG_CONDREF(name, variable, type, SL_MIN_VERSION, SL_MAX_VERSION) |
Storage of a global reference in every savegame version.
name | The name of the field. |
variable | Name of the global variable. |
type | Storage of the data in memory and in the savegame. |
Definition at line 1194 of file saveload.h.
#define SLEG_REFLIST | ( | name, | |
variable, | |||
type | |||
) | SLEG_CONDREFLIST(name, variable, type, SL_MIN_VERSION, SL_MAX_VERSION) |
Storage of a global reference list in every savegame version.
name | The name of the field. |
variable | Name of the global variable. |
type | Storage of the data in memory and in the savegame. |
Definition at line 1226 of file saveload.h.
#define SLEG_SSTR | ( | name, | |
variable, | |||
type | |||
) | SLEG_CONDSSTR(name, variable, type, SL_MIN_VERSION, SL_MAX_VERSION) |
Storage of a global std::string
in every savegame version.
name | The name of the field. |
variable | Name of the global variable. |
type | Storage of the data in memory and in the savegame. |
Definition at line 1211 of file saveload.h.
#define SLEG_STRUCT | ( | name, | |
handler | |||
) | SLEG_CONDSTRUCT(name, handler, SL_MIN_VERSION, SL_MAX_VERSION) |
Storage of a structs in every savegame version.
name | The name of the field. |
handler | SaveLoadHandler for the structs. |
Definition at line 1218 of file saveload.h.
#define SLEG_STRUCTLIST | ( | name, | |
handler | |||
) | SLEG_CONDSTRUCTLIST(name, handler, SL_MIN_VERSION, SL_MAX_VERSION) |
Storage of a list of structs in every savegame version.
name | The name of the field. |
handler | SaveLoadHandler for the list of structs. |
Definition at line 1241 of file saveload.h.
#define SLEG_VAR | ( | name, | |
variable, | |||
type | |||
) | SLEG_CONDVAR(name, variable, type, SL_MIN_VERSION, SL_MAX_VERSION) |
Storage of a global variable in every savegame version.
name | The name of the field. |
variable | Name of the global variable. |
type | Storage of the data in memory and in the savegame. |
Definition at line 1186 of file saveload.h.
#define SLEG_VECTOR | ( | name, | |
variable, | |||
type | |||
) | SLEG_CONDVECTOR(name, variable, type, SL_MIN_VERSION, SL_MAX_VERSION) |
Storage of a global vector of SL_VAR elements in every savegame version.
name | The name of the field. |
variable | Name of the global variable. |
type | Storage of the data in memory and in the savegame. |
Definition at line 1234 of file saveload.h.
typedef void AutolengthProc(int) |
Definition at line 448 of file saveload.h.
using ChunkHandlerRef = std::reference_wrapper<const ChunkHandler> |
A reference to ChunkHandler.
Definition at line 509 of file saveload.h.
using ChunkHandlerTable = std::span<const ChunkHandlerRef> |
A table of ChunkHandler entries.
Definition at line 512 of file saveload.h.
typedef void * SaveLoadAddrProc(void *base, size_t extra) |
Definition at line 714 of file saveload.h.
using SaveLoadCompatTable = std::span<const struct SaveLoadCompat> |
A table of SaveLoadCompat entries.
Definition at line 518 of file saveload.h.
using SaveLoadTable = std::span<const struct SaveLoad> |
A table of SaveLoad entries.
Definition at line 515 of file saveload.h.
typedef uint32_t VarType |
Definition at line 692 of file saveload.h.
enum ChunkType |
Type of a chunk.
Enumerator | |
---|---|
CH_TYPE_MASK | All ChunkType values have to be within this mask. |
CH_READONLY | Chunk is never saved. |
Definition at line 451 of file saveload.h.
enum SavegameType |
Types of save games.
Definition at line 423 of file saveload.h.
enum SaveLoadType : uint8_t |
Type of data saved.
Enumerator | |
---|---|
SL_VAR | Save/load a variable. |
SL_REF | Save/load a reference. |
SL_STRUCT | Save/load a struct. |
SL_STDSTR | Save/load a |
SL_ARR | Save/load a fixed-size array of SL_VAR elements. |
SL_DEQUE | Save/load a deque of SL_VAR elements. |
SL_VECTOR | Save/load a vector of SL_VAR elements. |
SL_REFLIST | Save/load a list of SL_REF elements. |
SL_STRUCTLIST | Save/load a list of structs. |
SL_SAVEBYTE | Save (but not load) a byte. |
SL_NULL | Save null-bytes and load to nowhere. |
SL_REFVECTOR | Save/load a vector of SL_REF elements. |
Definition at line 695 of file saveload.h.
enum SaveLoadVersion : uint16_t |
SaveLoad versions Previous savegame versions, the trunk revision where they were introduced and the released version that had that particular savegame version.
Up to savegame version 18 there is a minor version as well.
Older entries keep their original numbering.
Newer entries should use a descriptive labels, numeric version and PR can be added to comment.
Note that this list must not be reordered.
Enumerator | |
---|---|
SL_MIN_VERSION | First savegame version. |
SLV_1 | 1.0 0.1.x, 0.2.x |
SLV_2 | 2.0 0.3.0 2.1 0.3.1, 0.3.2 |
SLV_3 | 3.x lost |
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 |
SLV_5 | 5.0 1429 5.1 1440 5.2 1525 0.3.6 |
SLV_6 | 6.0 1721 6.1 1768 |
SLV_7 | 7.0 1770 |
SLV_8 | 8.0 1786 |
SLV_9 | 9.0 1909 |
SLV_10 | 10.0 2030 |
SLV_11 | 11.0 2033 11.1 2041 |
SLV_12 | 12.1 2046 |
SLV_13 | 13.1 2080 0.4.0, 0.4.0.1 |
SLV_14 | 14.0 2441 |
SLV_15 | 15.0 2499 |
SLV_16 | 16.0 2817 16.1 3155 |
SLV_17 | 17.0 3212 17.1 3218 |
SLV_18 | 18 3227 |
SLV_19 | 19 3396 |
SLV_20 | 20 3403 |
SLV_21 | 21 3472 0.4.x |
SLV_22 | 22 3726 |
SLV_23 | 23 3915 |
SLV_24 | 24 4150 |
SLV_25 | 25 4259 |
SLV_26 | 26 4466 |
SLV_27 | 27 4757 |
SLV_28 | 28 4987 |
SLV_29 | 29 5070 |
SLV_30 | 30 5946 |
SLV_31 | 31 5999 |
SLV_32 | 32 6001 |
SLV_33 | 33 6440 |
SLV_34 | 34 6455 |
SLV_35 | 35 6602 |
SLV_36 | 36 6624 |
SLV_37 | 37 7182 |
SLV_38 | 38 7195 |
SLV_39 | 39 7269 |
SLV_40 | 40 7326 |
SLV_41 | 41 7348 0.5.x |
SLV_42 | 42 7573 |
SLV_43 | 43 7642 |
SLV_44 | 44 8144 |
SLV_45 | 45 8501 |
SLV_46 | 46 8705 |
SLV_47 | 47 8735 |
SLV_48 | 48 8935 |
SLV_49 | 49 8969 |
SLV_50 | 50 8973 |
SLV_51 | 51 8978 |
SLV_52 | 52 9066 |
SLV_53 | 53 9316 |
SLV_54 | 54 9613 |
SLV_55 | 55 9638 |
SLV_56 | 56 9667 |
SLV_57 | 57 9691 |
SLV_58 | 58 9762 |
SLV_59 | 59 9779 |
SLV_60 | 60 9874 |
SLV_61 | 61 9892 |
SLV_62 | 62 9905 |
SLV_63 | 63 9956 |
SLV_64 | 64 10006 |
SLV_65 | 65 10210 |
SLV_66 | 66 10211 |
SLV_67 | 67 10236 |
SLV_68 | 68 10266 |
SLV_69 | 69 10319 |
SLV_70 | 70 10541 |
SLV_71 | 71 10567 |
SLV_72 | 72 10601 |
SLV_73 | 73 10903 |
SLV_74 | 74 11030 |
SLV_75 | 75 11107 |
SLV_76 | 76 11139 |
SLV_77 | 77 11172 |
SLV_78 | 78 11176 |
SLV_79 | 79 11188 |
SLV_80 | 80 11228 |
SLV_81 | 81 11244 |
SLV_82 | 82 11410 |
SLV_83 | 83 11589 |
SLV_84 | 84 11822 |
SLV_85 | 85 11874 |
SLV_86 | 86 12042 |
SLV_87 | 87 12129 |
SLV_88 | 88 12134 |
SLV_89 | 89 12160 |
SLV_90 | 90 12293 |
SLV_91 | 91 12347 |
SLV_92 | 92 12381 0.6.x |
SLV_93 | 93 12648 |
SLV_94 | 94 12816 |
SLV_95 | 95 12924 |
SLV_96 | 96 13226 |
SLV_97 | 97 13256 |
SLV_98 | 98 13375 |
SLV_99 | 99 13838 |
SLV_100 | 100 13952 |
SLV_101 | 101 14233 |
SLV_102 | 102 14332 |
SLV_103 | 103 14598 |
SLV_104 | 104 14735 |
SLV_105 | 105 14803 |
SLV_106 | 106 14919 |
SLV_107 | 107 15027 |
SLV_108 | 108 15045 |
SLV_109 | 109 15075 |
SLV_110 | 110 15148 |
SLV_111 | 111 15190 |
SLV_112 | 112 15290 |
SLV_113 | 113 15340 |
SLV_114 | 114 15601 |
SLV_115 | 115 15695 |
SLV_116 | 116 15893 0.7.x |
SLV_117 | 117 16037 |
SLV_118 | 118 16129 |
SLV_119 | 119 16242 |
SLV_120 | 120 16439 |
SLV_121 | 121 16694 |
SLV_122 | 122 16855 |
SLV_123 | 123 16909 |
SLV_124 | 124 16993 |
SLV_125 | 125 17113 |
SLV_126 | 126 17433 |
SLV_127 | 127 17439 |
SLV_128 | 128 18281 |
SLV_129 | 129 18292 |
SLV_130 | 130 18404 |
SLV_131 | 131 18481 |
SLV_132 | 132 18522 |
SLV_133 | 133 18674 |
SLV_134 | 134 18703 |
SLV_135 | 135 18719 |
SLV_136 | 136 18764 |
SLV_137 | 137 18912 |
SLV_138 | 138 18942 1.0.x |
SLV_139 | 139 19346 |
SLV_140 | 140 19382 |
SLV_141 | 141 19799 |
SLV_142 | 142 20003 |
SLV_143 | 143 20048 |
SLV_144 | 144 20334 |
SLV_145 | 145 20376 |
SLV_146 | 146 20446 |
SLV_147 | 147 20621 |
SLV_148 | 148 20659 |
SLV_149 | 149 20832 |
SLV_150 | 150 20857 |
SLV_151 | 151 20918 |
SLV_152 | 152 21171 |
SLV_153 | 153 21263 |
SLV_154 | 154 21426 |
SLV_155 | 155 21453 |
SLV_156 | 156 21728 |
SLV_157 | 157 21862 |
SLV_158 | 158 21933 |
SLV_159 | 159 21962 |
SLV_160 | 160 21974 1.1.x |
SLV_161 | 161 22567 |
SLV_162 | 162 22713 |
SLV_163 | 163 22767 |
SLV_164 | 164 23290 |
SLV_165 | 165 23304 |
SLV_166 | 166 23415 |
SLV_167 | 167 23504 |
SLV_168 | 168 23637 |
SLV_169 | 169 23816 |
SLV_170 | 170 23826 |
SLV_171 | 171 23835 |
SLV_172 | 172 23947 |
SLV_173 | 173 23967 1.2.0-RC1 |
SLV_174 | 174 23973 1.2.x |
SLV_175 | 175 24136 |
SLV_176 | 176 24446 |
SLV_177 | 177 24619 |
SLV_178 | 178 24789 |
SLV_179 | 179 24810 |
SLV_180 | 180 24998 1.3.x |
SLV_181 | 181 25012 |
SLV_182 | 182 25115 FS#5492, r25259, r25296 Goal status |
SLV_183 | 183 25363 Cargodist |
SLV_184 | 184 25508 Unit localisation split |
SLV_185 | 185 25620 Storybooks |
SLV_186 | 186 25833 Objects storage |
SLV_187 | 187 25899 Linkgraph - restricted flows |
SLV_188 | 188 26169 v1.4 FS#5831 Unify RV travel time |
SLV_189 | 189 26450 Hierarchical vehicle subgroups |
SLV_190 | 190 26547 Separate order travel and wait times |
SLV_191 | 191 26636 FS#6026 Fix disaster vehicle storage (No bump) 191 26646 FS#6041 Linkgraph - store locations |
SLV_192 | 192 26700 FS#6066 Fix saving of order backups |
SLV_193 | 193 26802 |
SLV_194 | 194 26881 v1.5 |
SLV_195 | 195 27572 v1.6.1 |
SLV_196 | 196 27778 v1.7 |
SLV_197 | 197 27978 v1.8 |
SLV_198 | 198 PR#6763 Switch town growth rate and counter to actual game ticks |
SLV_EXTEND_CARGOTYPES | 199 PR#6802 Extend cargotypes to 64 |
SLV_EXTEND_RAILTYPES | 200 PR#6805 Extend railtypes to 64, adding uint16_t to map array. |
SLV_EXTEND_PERSISTENT_STORAGE | 201 PR#6885 Extend NewGRF persistent storages. |
SLV_EXTEND_INDUSTRY_CARGO_SLOTS | 202 PR#6867 Increase industry cargo slots to 16 in, 16 out |
SLV_SHIP_PATH_CACHE | 203 PR#7072 Add path cache for ships |
SLV_SHIP_ROTATION | 204 PR#7065 Add extra rotation stages for ships. |
SLV_GROUP_LIVERIES | 205 PR#7108 Livery storage change and group liveries. |
SLV_SHIPS_STOP_IN_LOCKS | 206 PR#7150 Ship/lock movement changes. |
SLV_FIX_CARGO_MONITOR | 207 PR#7175 v1.9 Cargo monitor data packing fix to support 64 cargotypes. |
SLV_TOWN_CARGOGEN | 208 PR#6965 New algorithms for town building cargo generation. |
SLV_SHIP_CURVE_PENALTY | 209 PR#7289 Configurable ship curve penalties. |
SLV_SERVE_NEUTRAL_INDUSTRIES | 210 PR#7234 Company stations can serve industries with attached neutral stations. |
SLV_ROADVEH_PATH_CACHE | 211 PR#7261 Add path cache for road vehicles. |
SLV_REMOVE_OPF | 212 PR#7245 Remove OPF. |
SLV_TREES_WATER_CLASS | 213 PR#7405 WaterClass update for tree tiles. |
SLV_ROAD_TYPES | 214 PR#6811 NewGRF road types. |
SLV_SCRIPT_MEMLIMIT | 215 PR#7516 Limit on AI/GS memory consumption. |
SLV_MULTITILE_DOCKS | 216 PR#7380 Multiple docks per station. |
SLV_TRADING_AGE | 217 PR#7780 Configurable company trading age. |
SLV_ENDING_YEAR | 218 PR#7747 v1.10 Configurable ending year. |
SLV_REMOVE_TOWN_CARGO_CACHE | 219 PR#8258 Remove town cargo acceptance and production caches. |
SLV_START_PATCHPACKS | 220 First known patchpack to use a version just above ours. |
SLV_END_PATCHPACKS | 286 Last known patchpack to use a version just above ours. |
SLV_GS_INDUSTRY_CONTROL | 287 PR#7912 and PR#8115 GS industry control. |
SLV_VEH_MOTION_COUNTER | 288 PR#8591 Desync safe motion counter |
SLV_INDUSTRY_TEXT | 289 PR#8576 v1.11.0-RC1 Additional GS text for industries. |
SLV_MAPGEN_SETTINGS_REVAMP | 290 PR#8891 v1.11 Revamp of some mapgen settings (snow coverage, desert coverage, heightmap height, custom terrain type). |
SLV_GROUP_REPLACE_WAGON_REMOVAL | 291 PR#7441 Per-group wagon removal flag. |
SLV_CUSTOM_SUBSIDY_DURATION | 292 PR#9081 Configurable subsidy duration. |
SLV_SAVELOAD_LIST_LENGTH | 293 PR#9374 Consistency in list length with SL_STRUCT / SL_STRUCTLIST / SL_DEQUE / SL_REFLIST. |
SLV_RIFF_TO_ARRAY | 294 PR#9375 Changed many CH_RIFF chunks to CH_ARRAY chunks. |
SLV_TABLE_CHUNKS | 295 PR#9322 Introduction of CH_TABLE and CH_SPARSE_TABLE. |
SLV_SCRIPT_INT64 | 296 PR#9415 SQInteger is 64bit but was saved as 32bit. |
SLV_LINKGRAPH_TRAVEL_TIME | 297 PR#9457 v12.0-RC1 Store travel time in the linkgraph. |
SLV_DOCK_DOCKINGTILES | 298 PR#9578 All tiles around docks may be docking tiles. |
SLV_REPAIR_OBJECT_DOCKING_TILES | 299 PR#9594 v12.0 Fixing issue with docking tiles overlapping objects. |
SLV_U64_TICK_COUNTER | 300 PR#10035 Make tick counter 64bit to avoid wrapping. |
SLV_LAST_LOADING_TICK | 301 PR#9693 Store tick of last loading for vehicles. |
SLV_MULTITRACK_LEVEL_CROSSINGS | 302 PR#9931 v13.0 Multi-track level crossings. |
SLV_NEWGRF_ROAD_STOPS | 303 PR#10144 NewGRF road stops. |
SLV_LINKGRAPH_EDGES | 304 PR#10314 Explicitly store link graph edges destination, PR#10471 int64_t instead of uint64_t league rating |
SLV_VELOCITY_NAUTICAL | 305 PR#10594 Separation of land and nautical velocity (knots!) |
SLV_CONSISTENT_PARTIAL_Z | 306 PR#10570 Conversion from an inconsistent partial Z calculation for slopes, to one that is (more) consistent. |
SLV_MORE_CARGO_AGE | 307 PR#10596 Track cargo age for a longer period. |
SLV_LINKGRAPH_SECONDS | 308 PR#10610 Store linkgraph update intervals in seconds instead of days. |
SLV_AI_START_DATE | 309 PR#10653 Removal of individual AI start dates and added a generic one. |
SLV_EXTEND_VEHICLE_RANDOM | 310 PR#10701 Extend vehicle random bits. |
SLV_EXTEND_ENTITY_MAPPING | 311 PR#10672 Extend entity mapping range. |
SLV_DISASTER_VEH_STATE | 312 PR#10798 Explicit storage of disaster vehicle state. |
SLV_SAVEGAME_ID | 313 PR#10719 Add an unique ID to every savegame (used to deduplicate surveys). |
SLV_STRING_GAMELOG | 314 PR#10801 Use std::string in gamelog. |
SLV_INDUSTRY_CARGO_REORGANISE | 315 PR#10853 Industry accepts/produced data reorganised. |
SLV_PERIODS_IN_TRANSIT_RENAME | 316 PR#11112 Rename days in transit to (cargo) periods in transit. |
SLV_NEWGRF_LAST_SERVICE | 317 PR#11124 Added stable date_of_last_service to avoid NewGRF trouble. |
SLV_REMOVE_LOADED_AT_XY | 318 PR#11276 Remove loaded_at_xy variable from CargoPacket. |
SLV_CARGO_TRAVELLED | 319 PR#11283 CargoPacket now tracks how far it travelled inside a vehicle. |
SLV_STATION_RATING_CHEAT | 320 PR#11346 Add cheat to fix station ratings at 100%. |
SLV_TIMETABLE_START_TICKS | 321 PR#11468 Convert timetable start from a date to ticks. |
SLV_TIMETABLE_START_TICKS_FIX | 322 PR#11557 Fix for missing convert timetable start from a date to ticks. |
SLV_TIMETABLE_TICKS_TYPE | 323 PR#11435 Convert timetable current order time to ticks. |
SLV_WATER_REGIONS | 324 PR#10543 Water Regions for ship pathfinder. |
SLV_WATER_REGION_EVAL_SIMPLIFIED | 325 PR#11750 Simplified Water Region evaluation. |
SLV_ECONOMY_DATE | 326 PR#10700 Split calendar and economy timers and dates. |
SLV_ECONOMY_MODE_TIMEKEEPING_UNITS | 327 PR#11341 Mode to display economy measurements in wallclock units. |
SLV_CALENDAR_SUB_DATE_FRACT | 328 PR#11428 Add sub_date_fract to measure calendar days. |
SLV_SHIP_ACCELERATION | 329 PR#10734 Start using Vehicle's acceleration field for ships too. |
SLV_MAX_LOAN_FOR_COMPANY | 330 PR#11224 Separate max loan for each company. |
SLV_DEPOT_UNBUNCHING | 331 PR#11945 Allow unbunching shared order vehicles at a depot. |
SLV_AI_LOCAL_CONFIG | |
SLV_SCRIPT_RANDOMIZER | 333 PR#12063 v14.0-RC1 Save script randomizers. |
SLV_VEHICLE_ECONOMY_AGE | 334 PR#12141 v14.0 Add vehicle age in economy year, for profit stats minimum age |
SLV_COMPANY_ALLOW_LIST | 335 PR#12337 Saving of list of client keys that are allowed to join this company. |
SLV_GROUP_NUMBERS | 336 PR#12297 Add per-company group numbers. |
SLV_INCREASE_STATION_TYPE_FIELD_SIZE | 337 PR#12572 Increase size of StationType field in map array |
SLV_ROAD_WAYPOINTS | 338 PR#12572 Road waypoints |
SLV_COMPANY_INAUGURATED_PERIOD | 339 PR#12798 Companies show the period inaugurated in wallclock mode. |
SLV_ROAD_STOP_TILE_DATA | 340 PR#12883 Move storage of road stop tile data, also save for road waypoints. |
SLV_COMPANY_ALLOW_LIST_V2 | 341 PR#12908 Fixed savegame format for saving of list of client keys that are allowed to join this company. |
SLV_WATER_TILE_TYPE | 342 PR#13030 Simplify water tile type. |
SLV_PRODUCTION_HISTORY | 343 PR#10541 Industry production history. |
SLV_ROAD_TYPE_LABEL_MAP | 344 PR#13021 Add road type label map to allow upgrade/conversion of road types. |
SLV_NONFLOODING_WATER_TILES | 345 PR#13013 Store water tile non-flooding state. |
SLV_PATH_CACHE_FORMAT | 346 PR#12345 Vehicle path cache format changed. |
SLV_ANIMATED_TILE_STATE_IN_MAP | 347 PR#13082 Animated tile state saved for improved performance. |
SLV_INCREASE_HOUSE_LIMIT | 348 PR#12288 Increase house limit to 4096. |
SL_MAX_VERSION | Highest possible saveload version. |
Definition at line 30 of file saveload.h.
enum SaveOrLoadResult |
Save or load result codes.
Definition at line 403 of file saveload.h.
enum SLRefType |
Type of reference (SLE_REF, SLE_CONDREF).
Definition at line 600 of file saveload.h.
enum VarTypes |
VarTypes is the general bitmasked magic type that tells us certain characteristics about the variable it refers to.
For example SLE_FILE_* gives the size(type) as it would be in the savegame and SLE_VAR_* the size(type) as it is in memory during runtime. These are the first 8 bits (0-3 SLE_FILE, 4-7 SLE_VAR). Bits 8-15 are reserved for various flags as explained below
Definition at line 623 of file saveload.h.
void DoAutoOrNetsave | ( | FiosNumberedSaveName & | counter | ) |
Create an autosave or netsave.
counter | A reference to the counter variable to be used for rotating the file name. |
netsave | Indicates if this is a regular autosave or a netsave. |
Definition at line 3219 of file saveload.cpp.
References _settings_client, AUTOSAVE_DIR, Debug, DFT_GAME_FILE, FiosNumberedSaveName::Extension(), FiosNumberedSaveName::Filename(), GenerateDefaultSaveName(), ClientSettings::gui, INVALID_STRING_ID, GUISettings::keep_all_autosave, SaveOrLoad(), ShowErrorMessage(), SL_OK, SLO_SAVE, and WL_ERROR.
Referenced by ClientNetworkEmergencySave().
void DoExitSave | ( | ) |
Do a save when exiting the game (_settings_client.gui.autosave_on_exit)
Definition at line 3237 of file saveload.cpp.
References AUTOSAVE_DIR, DFT_GAME_FILE, SaveOrLoad(), and SLO_SAVE.
Referenced by VideoDriver_Null::MainLoop(), and MainWindow::OnHotkey().
std::string GenerateDefaultSaveName | ( | ) |
Get the default name for a savegame or screenshot.
Definition at line 3245 of file saveload.cpp.
References _local_company, _settings_client, TimerGameTick::counter, TimerGameEconomy::date, GUISettings::date_format_in_default_names, GetString(), ClientSettings::gui, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Iterate(), SanitizeFilename(), SetDParam(), Ticks::TICKS_PER_SECOND, and TimerGameEconomy::UsingWallclockUnits().
Referenced by DoAutoOrNetsave(), SaveLoadWindow::GenerateFileName(), and MakeScreenshotName().
StringID GetSaveLoadErrorMessage | ( | ) |
Return the description of the error.
Definition at line 2842 of file saveload.cpp.
References _sl, SaveLoadParams::error_str, SaveLoadParams::extra_msg, and SetDParamStr().
Referenced by SaveFileError(), SaveFileToDisk(), and SaveOrLoad().
StringID GetSaveLoadErrorType | ( | ) |
Return the appropriate initial string for an error depending on whether we are saving or loading.
Definition at line 2836 of file saveload.cpp.
References _sl, SaveLoadParams::action, and SLA_SAVE.
Referenced by SaveFileError(), SaveFileToDisk(), and SaveOrLoad().
|
inlineconstexpr |
Get the FileType of a setting.
This describes the integer type as it is represented in a savegame/file
type | VarType holding information about the file-type |
Definition at line 762 of file saveload.h.
References GB().
Referenced by GetSavegameFileType(), GetSettingsDesc(), SlCalcConvFileLen(), SlCompatTableHeader(), and SlSaveLoadConv().
|
inline |
Get the address of the variable.
Null-variables don't have an address, everything else has a callback function that returns the address based on the saveload data and the current object for non-globals.
Definition at line 1301 of file saveload.h.
References SaveLoad::address_proc, SaveLoad::conv, SaveLoad::extra_data, GetVarMemType(), and SLE_VAR_NULL.
Referenced by ListSettingDesc::FormatValue(), ListSettingDesc::ParseValue(), IntSettingDesc::Read(), StringSettingDesc::Read(), StringSettingDesc::Write(), and IntSettingDesc::Write().
|
inlineconstexpr |
Get the NumberType of a setting.
This describes the integer type as it is represented in memory
type | VarType holding information about the variable-type |
Definition at line 751 of file saveload.h.
References GB().
Referenced by StringSettingDesc::FormatValue(), ListSettingDesc::FormatValue(), GetVariableAddress(), IsNumericType(), StringSettingDesc::IsSameValue(), IntSettingDesc::MakeValueValid(), ListSettingDesc::ParseValue(), ReadValue(), SetSettingValue(), SlArray(), SlCalcConvMemLen(), SlCalcDequeLen(), SlCalcVectorLen(), SlCopyInternal(), SlDeque(), SlStdString(), SlVarSize(), SlVector(), and WriteValue().
|
inlineconstexpr |
Check if the given saveload type is a numeric type.
conv | the type to check |
Definition at line 772 of file saveload.h.
References GetVarMemType().
|
inline |
Checks whether the savegame is below major.
minor.
major | Major number of the version to check against. |
minor | Minor number of the version to check against. If minor is 0 or not specified, only the major number is checked. |
Definition at line 1263 of file saveload.h.
References _sl_minor_version, and _sl_version.
Referenced by CargoPacket::AfterLoad(), AfterLoadGame(), AfterLoadLinkGraphs(), AfterLoadStoryBook(), AfterLoadVehiclesPhase2(), Order::ConvertFromOldSavegame(), CopyFromOldName(), DoLoad(), DEPTChunkHandler::FixPointers(), OBJSChunkHandler::FixPointers(), ORDRChunkHandler::FixPointers(), STNSChunkHandler::FixPointers(), STNNChunkHandler::FixPointers(), CITYChunkHandler::FixPointers(), CHKPChunkHandler::FixPointers(), SlStationSpecList< T >::GetLength(), SlStationGoods::GetNumCargo(), SlTownSupplied::GetNumCargo(), SlCompanyLiveries::GetNumLiveries(), GetSavegameFileType(), GetSettingsDesc(), HandleOldDiffCustom(), IntToReference(), ANITChunkHandler::Load(), ERNWChunkHandler::Load(), CMDLChunkHandler::Load(), CMPUChunkHandler::Load(), CHTSChunkHandler::Load(), DEPTChunkHandler::Load(), PRICChunkHandler::Load(), CAPRChunkHandler::Load(), ECMYChunkHandler::Load(), ENGNChunkHandler::Load(), GRPSChunkHandler::Load(), INDYChunkHandler::Load(), IBLDChunkHandler::Load(), LGRSChunkHandler::Load(), MAPSChunkHandler::Load(), MAP2ChunkHandler::Load(), MAPEChunkHandler::Load(), VIEWChunkHandler::Load(), ORDRChunkHandler::Load(), SIGNChunkHandler::Load(), VEHSChunkHandler::Load(), PLYRChunkHandler::LoadCheck(), MAPSChunkHandler::LoadCheck(), DATEChunkHandler::LoadCheck(), ScriptInstance::LoadObjects(), LoadSettings(), MoveWaypointsToBaseStations(), SlArray(), SlCalcRefLen(), SlStorageHelper< Tstorage, Tvar, Tallocator >::SlSaveLoad(), SlSaveLoadRef(), and SlStdString().
|
inline |
Checks whether the savegame is below or at major.
This should be used to repair data from existing savegames which is no longer corrupted in new savegames, but for which otherwise no savegame bump is required.
major | Major number of the version to check against. |
Definition at line 1277 of file saveload.h.
References _sl_version.
Referenced by AfterLoadGame().
void ProcessAsyncSaveFinish | ( | ) |
Handle async save finishes.
Definition at line 376 of file saveload.cpp.
References _async_save_finish, and _save_thread.
int64_t ReadValue | ( | const void * | ptr, |
VarType | conv | ||
) |
Return a signed-long version of the value of a setting.
ptr | pointer to the variable |
conv | type of variable, can be a non-clean type, eg one with other flags because it is parsed |
Definition at line 794 of file saveload.cpp.
References GetVarMemType(), and SLE_VAR_NULL.
Referenced by CheatWindow::DrawWidget(), CheatWindow::OnClick(), CheatWindow::OnQueryTextFinished(), IntSettingDesc::Read(), and SlSaveLoadConv().
bool SaveloadCrashWithMissingNewGRFs | ( | ) |
Did loading the savegame cause a crash? If so, were NewGRFs missing?
Definition at line 353 of file afterload.cpp.
References _saveload_crash_with_missing_newgrfs.
Referenced by HandleCrash(), and HandleCrash().
SaveOrLoadResult SaveOrLoad | ( | const std::string & | filename, |
SaveLoadOperation | fop, | ||
DetailedFileType | dft, | ||
Subdirectory | sb, | ||
bool | threaded | ||
) |
Main Save or Load function where the high-level saveload functions are handled.
It opens the savegame, selects format and checks versions
filename | The name of the savegame being created/loaded |
fop | Save or load mode. Load can also be a TTD(Patch) game. |
sb | The sub directory to save the savegame in |
threaded | True when threaded saving is allowed |
Definition at line 3128 of file saveload.cpp.
References _do_autosave, _gamelog, _grfconfig, _settings_client, _sl, _sl_minor_version, _sl_version, SaveLoadParams::action, AfterLoadGame(), BASE_DIR, ClearGRFConfigList(), ClearSaveLoadState(), TimerGameEconomy::date, TimerGameEconomy::date_fract, Debug, DFT_GAME_FILE, DFT_OLD_GAME_FILE, DoLoad(), DoSave(), FioFOpenFile(), GetSaveLoadErrorMessage(), GetSaveLoadErrorType(), GetString(), GLAT_LOAD, ClientSettings::gui, INVALID_STRING_ID, Gamelog::Reset(), ResetSaveloadData(), SAVE_DIR, SaveLoadParams::saveinprogress, SCENARIO_DIR, ShowErrorMessage(), SL_MIN_VERSION, SL_OK, SL_REINIT, SLA_LOAD, SLA_LOAD_CHECK, SLA_SAVE, SlError(), SLO_CHECK, SLO_LOAD, SLO_SAVE, Gamelog::StartAction(), Gamelog::StopAction(), GUISettings::threaded_saves, and WL_ERROR.
Referenced by _GenerateWorld(), DEF_CONSOLE_CMD(), DoAutoOrNetsave(), DoExitSave(), LoadIntroGame(), SaveLoadWindow::OnClick(), openttd_main(), SafeLoad(), StateGameLoop(), and CrashLog::WriteSavegame().
void SetSaveLoadError | ( | StringID | str | ) |
Set the error message from outside of the actual loading/saving of the game (AfterLoadGame and friends)
Definition at line 2830 of file saveload.cpp.
References _sl, and SaveLoadParams::error_str.
Referenced by AfterLoadGame().
void SlAutolength | ( | AutolengthProc * | proc, |
int | arg | ||
) |
Do something of which I have no idea what it is :P.
proc | The callback procedure that is called |
arg | The variable that will be used for the callback procedure |
Definition at line 1988 of file saveload.cpp.
References _sl, SaveLoadParams::action, SaveLoadParams::dumper, SaveLoadParams::need_length, NL_CALCLENGTH, NL_WANTLENGTH, SaveLoadParams::obj_len, SLA_SAVE, and SlSetLength().
Referenced by AIPLChunkHandler::Save(), and GSDTChunkHandler::Save().
size_t SlCalcObjLength | ( | const void * | object, |
const SaveLoadTable & | slt | ||
) |
Calculate the size of an object.
object | to be measured. |
slt | The SaveLoad table with objects to save/load. |
Definition at line 1539 of file saveload.cpp.
Referenced by SlObject().
size_t SlCalcObjMemberLength | ( | const void * | object, |
const SaveLoad & | sld | ||
) |
Definition at line 1550 of file saveload.cpp.
|
inlineconstexpr |
Check if a saveload cmd/type/length entry matches the size of the variable.
cmd | SaveLoadType of entry. |
type | VarType of entry. |
length | Array length of entry. |
size | Actual size of variable. |
Definition at line 810 of file saveload.h.
References SL_ARR, SL_DEQUE, SL_REF, SL_REFLIST, SL_REFVECTOR, SL_SAVEBYTE, SL_STDSTR, SL_VAR, SL_VECTOR, and SlVarSize().
std::vector< SaveLoad > SlCompatTableHeader | ( | const SaveLoadTable & | slt, |
const SaveLoadCompatTable & | slct | ||
) |
Load a table header in a savegame compatible way.
If the savegame was made before table headers were added, it will fall back to the SaveLoadCompatTable for the order of fields while loading.
slt | The SaveLoad table with objects to save/load. |
slct | The SaveLoadCompat table the original order of the fields. |
Definition at line 1924 of file saveload.cpp.
References _sl, SaveLoadParams::action, SaveLoadParams::block_mode, SaveLoad::cmd, Debug, GetVarFileType(), SaveLoad::handler, SaveLoad::name, SL_NULL, SL_STRUCT, SL_STRUCTLIST, SLA_LOAD, SLA_LOAD_CHECK, SlCompatTableHeader(), SLE_VAR_NULL, SlErrorCorrupt(), SlIsObjectValidInSavegame(), and SlTableHeader().
Referenced by AIPLChunkHandler::Load(), ANITChunkHandler::Load(), ERNWChunkHandler::Load(), CMDLChunkHandler::Load(), CMPUChunkHandler::Load(), CAPAChunkHandler::Load(), CHTSChunkHandler::Load(), PLYRChunkHandler::Load(), DEPTChunkHandler::Load(), ECMYChunkHandler::Load(), CAPYChunkHandler::Load(), ENGNChunkHandler::Load(), EIDSChunkHandler::Load(), GSDTChunkHandler::Load(), GSTRChunkHandler::Load(), GOALChunkHandler::Load(), GRPSChunkHandler::Load(), INDYChunkHandler::Load(), IBLDChunkHandler::Load(), ITBLChunkHandler::Load(), RAILChunkHandler::Load(), ROTTChunkHandler::Load(), LGRPChunkHandler::Load(), LGRJChunkHandler::Load(), LGRSChunkHandler::Load(), MAPSChunkHandler::Load(), VIEWChunkHandler::Load(), NewGRFMappingChunkHandler::Load(), OBJSChunkHandler::Load(), ORDRChunkHandler::Load(), ORDLChunkHandler::Load(), BKORChunkHandler::Load(), SIGNChunkHandler::Load(), STNSChunkHandler::Load(), STNNChunkHandler::Load(), ROADChunkHandler::Load(), PSACChunkHandler::Load(), STPEChunkHandler::Load(), STPAChunkHandler::Load(), SUBSChunkHandler::Load(), CITYChunkHandler::Load(), VEHSChunkHandler::Load(), PLYRChunkHandler::LoadCheck(), MAPSChunkHandler::LoadCheck(), LoadSettings(), and SlCompatTableHeader().
void SlCopy | ( | void * | object, |
size_t | length, | ||
VarType | conv | ||
) |
Copy a list of SL_VARs to/from a savegame.
These entries are copied as-is, and you as caller have to make sure things like length-fields are calculated correctly.
object | The object being manipulated. |
length | The length of the object in elements |
conv | VarType type of the items. |
Definition at line 1030 of file saveload.cpp.
References _sl, SaveLoadParams::action, SaveLoadParams::need_length, NL_CALCLENGTH, NL_NONE, SLA_NULL, SLA_PTRS, SlCalcConvFileLen(), SlCopyInternal(), and SlSetLength().
Referenced by ANITChunkHandler::Load(), PRICChunkHandler::Load(), CAPRChunkHandler::Load(), ENGSChunkHandler::Load(), MAPTChunkHandler::Load(), MAPHChunkHandler::Load(), MAPOChunkHandler::Load(), MAP2ChunkHandler::Load(), M3LOChunkHandler::Load(), M3HIChunkHandler::Load(), MAP5ChunkHandler::Load(), MAPEChunkHandler::Load(), MAP7ChunkHandler::Load(), MAP8ChunkHandler::Load(), ORDRChunkHandler::Load(), NAMEChunkHandler::Load(), ScriptInstance::LoadObjects(), MAPTChunkHandler::Save(), MAPHChunkHandler::Save(), MAPOChunkHandler::Save(), MAP2ChunkHandler::Save(), M3LOChunkHandler::Save(), M3HIChunkHandler::Save(), MAP5ChunkHandler::Save(), MAPEChunkHandler::Save(), MAP7ChunkHandler::Save(), MAP8ChunkHandler::Save(), and ScriptInstance::SaveObject().
size_t SlGetFieldLength | ( | ) |
Get the length of the current object.
Definition at line 782 of file saveload.cpp.
References _sl, and SaveLoadParams::obj_len.
Referenced by ANITChunkHandler::Load(), CHTSChunkHandler::Load(), ORDRChunkHandler::Load(), and NAMEChunkHandler::Load().
size_t SlGetStructListLength | ( | size_t | limit | ) |
Get the length of this list; if it exceeds the limit, error out.
limit | The maximum size the list can be. |
Definition at line 1720 of file saveload.cpp.
References SlErrorCorrupt().
Referenced by VectorSaveLoadHandler< TImpl, TObject, TElementType, MAX_LENGTH >::GetLength(), SlStationSpecList< T >::GetLength(), SlStationGoods::GetNumCargo(), SlTownSupplied::GetNumCargo(), SlCompanyLiveries::GetNumLiveries(), and SlSkipHandler::Load().
void SlGlobList | ( | const SaveLoadTable & | slt | ) |
Save or Load (a list of) global variables.
slt | The SaveLoad table with objects to save/load. |
Definition at line 1978 of file saveload.cpp.
References SlObject().
Referenced by ANITChunkHandler::Load(), IBLDChunkHandler::Load(), MAPSChunkHandler::Load(), VIEWChunkHandler::Load(), MAPSChunkHandler::LoadCheck(), ANITChunkHandler::Save(), IBLDChunkHandler::Save(), MAPSChunkHandler::Save(), DATEChunkHandler::Save(), and VIEWChunkHandler::Save().
|
inline |
Checks if some version from/to combination falls within the range of the active savegame version.
version_from | Inclusive savegame version lower bound. |
version_to | Exclusive savegame version upper bound. SL_MAX_VERSION if no upper bound. |
Definition at line 1290 of file saveload.h.
References SAVEGAME_VERSION.
Referenced by CmdChangeSetting(), GetSaveLoadFromSettingTable(), GetSettingFromName(), IniLoadSettings(), IniSaveSettings(), LoadSettings(), and SurveySettingsTable().
int SlIterateArray | ( | ) |
Iterate through the elements of an array and read the whole thing.
Definition at line 659 of file saveload.cpp.
References _sl, SaveLoadParams::block_mode, Debug, SaveLoadParams::expect_table_header, SaveLoadParams::obj_len, and SaveLoadParams::reader.
Referenced by AIPLChunkHandler::Load(), ANITChunkHandler::Load(), ERNWChunkHandler::Load(), CMDLChunkHandler::Load(), CMPUChunkHandler::Load(), CAPAChunkHandler::Load(), CHTSChunkHandler::Load(), PLYRChunkHandler::Load(), DEPTChunkHandler::Load(), ECMYChunkHandler::Load(), CAPYChunkHandler::Load(), ENGNChunkHandler::Load(), EIDSChunkHandler::Load(), GSDTChunkHandler::Load(), GSTRChunkHandler::Load(), GOALChunkHandler::Load(), GRPSChunkHandler::Load(), INDYChunkHandler::Load(), IBLDChunkHandler::Load(), ITBLChunkHandler::Load(), RAILChunkHandler::Load(), ROTTChunkHandler::Load(), LEAEChunkHandler::Load(), LEATChunkHandler::Load(), LGRPChunkHandler::Load(), LGRJChunkHandler::Load(), LGRSChunkHandler::Load(), MAPSChunkHandler::Load(), VIEWChunkHandler::Load(), NewGRFMappingChunkHandler::Load(), OBJSChunkHandler::Load(), ORDRChunkHandler::Load(), ORDLChunkHandler::Load(), BKORChunkHandler::Load(), SRNDChunkHandler::Load(), SIGNChunkHandler::Load(), STNSChunkHandler::Load(), STNNChunkHandler::Load(), ROADChunkHandler::Load(), PSACChunkHandler::Load(), STPEChunkHandler::Load(), STPAChunkHandler::Load(), NAMEChunkHandler::Load(), SUBSChunkHandler::Load(), CITYChunkHandler::Load(), VEHSChunkHandler::Load(), CHKPChunkHandler::Load(), PLYRChunkHandler::LoadCheck(), MAPSChunkHandler::LoadCheck(), LoadSettings(), SlLoadCheckChunk(), SlLoadChunk(), and SlSkipArray().
void SlObject | ( | void * | object, |
const SaveLoadTable & | slt | ||
) |
Main SaveLoad function.
object | The object that is being saved or loaded. |
slt | The SaveLoad table with objects to save/load. |
Definition at line 1733 of file saveload.cpp.
References _sl, SaveLoadParams::need_length, NL_CALCLENGTH, NL_NONE, SlCalcObjLength(), and SlSetLength().
Referenced by ERNWChunkHandler::FixPointers(), PLYRChunkHandler::FixPointers(), DEPTChunkHandler::FixPointers(), CAPYChunkHandler::FixPointers(), INDYChunkHandler::FixPointers(), LGRSChunkHandler::FixPointers(), OBJSChunkHandler::FixPointers(), ORDRChunkHandler::FixPointers(), ORDLChunkHandler::FixPointers(), BKORChunkHandler::FixPointers(), STNSChunkHandler::FixPointers(), STNNChunkHandler::FixPointers(), ROADChunkHandler::FixPointers(), CITYChunkHandler::FixPointers(), VEHSChunkHandler::FixPointers(), CHKPChunkHandler::FixPointers(), AIPLChunkHandler::Load(), ERNWChunkHandler::Load(), CMDLChunkHandler::Load(), CMPUChunkHandler::Load(), CAPAChunkHandler::Load(), CHTSChunkHandler::Load(), PLYRChunkHandler::Load(), DEPTChunkHandler::Load(), ECMYChunkHandler::Load(), CAPYChunkHandler::Load(), ENGNChunkHandler::Load(), EIDSChunkHandler::Load(), GSDTChunkHandler::Load(), GSTRChunkHandler::Load(), GOALChunkHandler::Load(), GRPSChunkHandler::Load(), INDYChunkHandler::Load(), ITBLChunkHandler::Load(), RAILChunkHandler::Load(), ROTTChunkHandler::Load(), LEAEChunkHandler::Load(), LEATChunkHandler::Load(), LGRPChunkHandler::Load(), LGRJChunkHandler::Load(), LGRSChunkHandler::Load(), NewGRFMappingChunkHandler::Load(), OBJSChunkHandler::Load(), ORDRChunkHandler::Load(), ORDLChunkHandler::Load(), BKORChunkHandler::Load(), SRNDChunkHandler::Load(), SIGNChunkHandler::Load(), STNSChunkHandler::Load(), STNNChunkHandler::Load(), ROADChunkHandler::Load(), PSACChunkHandler::Load(), STPEChunkHandler::Load(), STPAChunkHandler::Load(), SUBSChunkHandler::Load(), CITYChunkHandler::Load(), VEHSChunkHandler::Load(), CHKPChunkHandler::Load(), ScriptInstance::Load(), SlSkipHandler::Load(), PLYRChunkHandler::LoadCheck(), ScriptInstance::LoadEmpty(), ScriptInstance::LoadObjects(), LoadSettings(), ScriptInstance::Save(), ERNWChunkHandler::Save(), CMDLChunkHandler::Save(), CMPUChunkHandler::Save(), CAPAChunkHandler::Save(), CHTSChunkHandler::Save(), PLYRChunkHandler::Save(), DEPTChunkHandler::Save(), ECMYChunkHandler::Save(), CAPYChunkHandler::Save(), ENGNChunkHandler::Save(), EIDSChunkHandler::Save(), GSTRChunkHandler::Save(), GLOGChunkHandler::Save(), GOALChunkHandler::Save(), GRPSChunkHandler::Save(), INDYChunkHandler::Save(), ITBLChunkHandler::Save(), RAILChunkHandler::Save(), ROTTChunkHandler::Save(), LEAEChunkHandler::Save(), LEATChunkHandler::Save(), LGRPChunkHandler::Save(), LGRJChunkHandler::Save(), LGRSChunkHandler::Save(), NGRFChunkHandler::Save(), NewGRFMappingChunkHandler::Save(), OBJSChunkHandler::Save(), ORDRChunkHandler::Save(), ORDLChunkHandler::Save(), BKORChunkHandler::Save(), SRNDChunkHandler::Save(), SIGNChunkHandler::Save(), STNNChunkHandler::Save(), ROADChunkHandler::Save(), PSACChunkHandler::Save(), STPEChunkHandler::Save(), STPAChunkHandler::Save(), SUBSChunkHandler::Save(), CITYChunkHandler::Save(), VEHSChunkHandler::Save(), ScriptInstance::SaveEmpty(), ScriptInstance::SaveObject(), SaveSettings(), and SlGlobList().
uint8_t SlReadByte | ( | ) |
Wrapper for reading a byte from the buffer.
Definition at line 392 of file saveload.cpp.
References _sl, and SaveLoadParams::reader.
Referenced by STNNChunkHandler::Load(), VEHSChunkHandler::Load(), SlCopyBytes(), SlLoadCheckChunk(), SlLoadChunk(), SlReadSimpleGamma(), SlSaveLoadConv(), and SlSkipBytes().
void SlSetArrayIndex | ( | uint | index | ) |
Definition at line 647 of file saveload.cpp.
void SlSetLength | ( | size_t | length | ) |
Sets the length of either a RIFF object or the number of items in an array.
This lets us load an object or an array of arbitrary size
length | The length of the sought object/array |
Definition at line 713 of file saveload.cpp.
References _sl, SaveLoadParams::action, SaveLoadParams::block_mode, SaveLoadParams::expect_table_header, SaveLoadParams::last_array_index, SaveLoadParams::need_length, NL_CALCLENGTH, NL_NONE, NL_WANTLENGTH, SaveLoadParams::obj_len, and SLA_SAVE.
Referenced by MAPTChunkHandler::Save(), MAPHChunkHandler::Save(), MAPOChunkHandler::Save(), MAP2ChunkHandler::Save(), M3LOChunkHandler::Save(), M3HIChunkHandler::Save(), MAP5ChunkHandler::Save(), MAPEChunkHandler::Save(), MAP7ChunkHandler::Save(), MAP8ChunkHandler::Save(), SlAutolength(), SlCopy(), SlObject(), SlRefList(), SlRefVector(), SlSetStructListLength(), and SlTableHeader().
void SlSetStructListLength | ( | size_t | length | ) |
Set the length of this list.
The | length of the list. |
Definition at line 1704 of file saveload.cpp.
References _sl, SaveLoadParams::need_length, NL_CALCLENGTH, NL_NONE, and SlSetLength().
|
inline |
Read in bytes from the file/data structure but don't do anything with them, discarding them in effect.
length | The amount of bytes that is being treated this way |
Definition at line 1345 of file saveload.h.
References SlReadByte().
Referenced by ChunkHandler::LoadCheck(), SlCopyInternal(), SlSkipArray(), and SlStdString().
std::vector< SaveLoad > SlTableHeader | ( | const SaveLoadTable & | slt | ) |
Save or Load a table header.
slt | The SaveLoad table with objects to save/load. |
Definition at line 1786 of file saveload.cpp.
References _sl, SaveLoadParams::action, SaveLoadParams::block_mode, SaveLoad::cmd, Debug, GetSavegameFileType(), SaveLoad::handler, SaveLoad::name, SaveLoadParams::need_length, NL_CALCLENGTH, NL_NONE, SL_ARR, SL_MAX_VERSION, SL_MIN_VERSION, SL_STDSTR, SL_STRUCT, SL_STRUCTLIST, SL_VAR, SLA_LOAD, SLA_LOAD_CHECK, SLA_SAVE, SlCalcTableHeader(), SLE_FILE_END, SLE_FILE_HAS_LENGTH_FIELD, SLE_FILE_TYPE_MASK, SLE_VAR_NULL, SlErrorCorrupt(), SlIsObjectValidInSavegame(), SlSaveLoadConv(), SlSetLength(), SlStdString(), and SlTableHeader().
Referenced by LEAEChunkHandler::Load(), LEATChunkHandler::Load(), SRNDChunkHandler::Load(), WaterRegionChunkHandler::Load(), ChunkHandler::LoadCheck(), AIPLChunkHandler::Save(), ANITChunkHandler::Save(), ERNWChunkHandler::Save(), CMDLChunkHandler::Save(), CMPUChunkHandler::Save(), CAPAChunkHandler::Save(), CHTSChunkHandler::Save(), PLYRChunkHandler::Save(), DEPTChunkHandler::Save(), ECMYChunkHandler::Save(), CAPYChunkHandler::Save(), ENGNChunkHandler::Save(), EIDSChunkHandler::Save(), GSDTChunkHandler::Save(), GSTRChunkHandler::Save(), GLOGChunkHandler::Save(), GOALChunkHandler::Save(), GRPSChunkHandler::Save(), INDYChunkHandler::Save(), IBLDChunkHandler::Save(), ITBLChunkHandler::Save(), RAILChunkHandler::Save(), ROTTChunkHandler::Save(), LEAEChunkHandler::Save(), LEATChunkHandler::Save(), LGRPChunkHandler::Save(), LGRJChunkHandler::Save(), LGRSChunkHandler::Save(), MAPSChunkHandler::Save(), DATEChunkHandler::Save(), VIEWChunkHandler::Save(), NGRFChunkHandler::Save(), NewGRFMappingChunkHandler::Save(), OBJSChunkHandler::Save(), ORDRChunkHandler::Save(), ORDLChunkHandler::Save(), BKORChunkHandler::Save(), SRNDChunkHandler::Save(), SIGNChunkHandler::Save(), STNNChunkHandler::Save(), ROADChunkHandler::Save(), PSACChunkHandler::Save(), STPEChunkHandler::Save(), STPAChunkHandler::Save(), SUBSChunkHandler::Save(), CITYChunkHandler::Save(), VEHSChunkHandler::Save(), SaveSettings(), SlCompatTableHeader(), and SlTableHeader().
|
inlineconstexpr |
Return expect size in bytes of a VarType.
type | VarType to get size of. |
Definition at line 782 of file saveload.h.
References GetVarMemType(), SLE_VAR_NAME, SLE_VAR_NULL, SLE_VAR_STR, and SLE_VAR_STRQ.
Referenced by LoadIntList(), and SlCheckVarSize().
void SlWriteByte | ( | uint8_t | b | ) |
Wrapper for writing a byte to the dumper.
b | The byte to write. |
Definition at line 401 of file saveload.cpp.
References _sl, and SaveLoadParams::dumper.
Referenced by SlCopyBytes(), SlSaveChunk(), SlSaveLoadConv(), and SlWriteSimpleGamma().
void WaitTillSaved | ( | ) |
Definition at line 2898 of file saveload.cpp.
void WriteValue | ( | void * | ptr, |
VarType | conv, | ||
int64_t | val | ||
) |
Write the value of a setting.
ptr | pointer to the variable |
conv | type of variable, can be a non-clean type, eg with other flags. It is parsed upon read |
val | the new value being given to the variable |
Definition at line 818 of file saveload.cpp.
References CopyFromOldName(), GetVarMemType(), SLE_VAR_NAME, and SLE_VAR_NULL.
Referenced by LoadIntList(), CheatWindow::OnClick(), CheatWindow::OnQueryTextFinished(), SlSaveLoadConv(), and IntSettingDesc::Write().
|
extern |
are we doing an autosave at the moment?
Definition at line 66 of file saveload.cpp.
Referenced by StatusBarWindow::DrawWidget(), and SaveOrLoad().
|
extern |
File to save or load in the openttd loop.
Definition at line 60 of file saveload.cpp.
Referenced by GenerateLandscape(), InitializeWindowsAndCaches(), SIGNChunkHandler::Load(), LoadTownData(), NetworkRestartMap(), SaveLoadWindow::OnClick(), SaveLoadWindow::OnTimeout(), openttd_main(), and ClientNetworkGameSocketHandler::Receive_SERVER_MAP_DONE().
|
extern |
how to compress savegames
Definition at line 65 of file saveload.cpp.
Referenced by SaveFileToDisk().