OpenTTD Source
20241108-master-g80f628063a
|
Handles the saveload part of the settings. More...
#include "../stdafx.h"
#include "saveload.h"
#include "compat/settings_sl_compat.h"
#include "../settings_type.h"
#include "../settings_table.h"
#include "../network/network.h"
#include "../fios.h"
#include "../safeguards.h"
Go to the source code of this file.
Data Structures | |
struct | OPTSChunkHandler |
struct | PATSChunkHandler |
Functions | |
void | PrepareOldDiffCustom () |
Prepare for reading and old diff_custom by zero-ing the memory. | |
void | HandleOldDiffCustom (bool savegame) |
Reading of the old diff_custom array and transforming it to the new format. More... | |
static std::vector< SaveLoad > | GetSettingsDesc (const SettingTable &settings, bool is_loading) |
Get the SaveLoad description for the SettingTable. More... | |
static void | LoadSettings (const SettingTable &settings, void *object, const SaveLoadCompatTable &slct) |
Save and load handler for settings. More... | |
static void | SaveSettings (const SettingTable &settings, void *object) |
Save and load handler for settings. More... | |
const ChunkHandlerTable | _setting_chunk_handlers (setting_chunk_handlers) |
Variables | |
static const OPTSChunkHandler | OPTS |
static const PATSChunkHandler | PATS |
static const ChunkHandlerRef | setting_chunk_handlers [] |
Handles the saveload part of the settings.
Definition in file settings_sl.cpp.
|
static |
Get the SaveLoad description for the SettingTable.
settings | SettingDesc struct containing all information. |
is_loading | True iff the SaveLoad table is for loading. |
Definition at line 77 of file settings_sl.cpp.
References _network_server, _networking, SaveLoad::cmd, SaveLoad::conv, SettingDesc::flags, SettingDesc::GetName(), GetSettingDesc(), GetVarFileType(), IsSavegameVersionBefore(), SaveLoad::length, SettingDesc::save, settings, SF_NO_NETWORK_SYNC, SF_NOT_IN_SAVE, SLE_VAR_NULL, SLV_TABLE_CHUNKS, SaveLoad::version_from, and SaveLoad::version_to.
Referenced by LoadSettings(), and SaveSettings().
void HandleOldDiffCustom | ( | bool | savegame | ) |
Reading of the old diff_custom array and transforming it to the new format.
savegame | is it read from the config or savegame. In the latter case we are sure there is an array; in the former case we have to check that. |
Definition at line 36 of file settings_sl.cpp.
References IsSavegameVersionBefore(), and SLV_4.
|
static |
Save and load handler for settings.
settings | SettingDesc struct containing all information |
object | can be either nullptr in which case we load global variables or a pointer to a struct which is getting saved |
Definition at line 104 of file settings_sl.cpp.
References _network_server, _networking, SettingDesc::AsIntSetting(), SettingDesc::flags, GetSettingDesc(), GetSettingsDesc(), SettingDesc::IsIntSetting(), IsSavegameVersionBefore(), IntSettingDesc::MakeValueValidAndWrite(), IntSettingDesc::Read(), SettingDesc::save, settings, SF_NO_NETWORK_SYNC, SF_NOT_IN_SAVE, SlCompatTableHeader(), SlErrorCorrupt(), SlIsObjectCurrentlyValid(), SlIterateArray(), SlObject(), SLV_RIFF_TO_ARRAY, SaveLoad::version_from, and SaveLoad::version_to.
Referenced by OPTSChunkHandler::Load(), PATSChunkHandler::Load(), and PATSChunkHandler::LoadCheck().
|
static |
Save and load handler for settings.
settings | SettingDesc struct containing all information |
object | can be either nullptr in which case we load global variables or a pointer to a struct which is getting saved |
Definition at line 132 of file settings_sl.cpp.
References GetSettingsDesc(), settings, and SlTableHeader().
Referenced by PATSChunkHandler::Save().
|
static |
Definition at line 219 of file settings_sl.cpp.