OpenTTD Source
12.0-beta2
|
Go to the documentation of this file.
10 #include "../stdafx.h"
15 #include "../gamelog_internal.h"
18 #include "../safeguards.h"
23 inline static const SaveLoad description[] = {
41 void LoadCheck(
LoggedChange *lc)
const override { this->Load(lc); }
46 inline static const SaveLoad description[] = {
66 void LoadCheck(
LoggedChange *lc)
const override { this->Load(lc); }
71 inline static const SaveLoad description[] = {
89 void LoadCheck(
LoggedChange *lc)
const override { this->Load(lc); }
94 inline static const SaveLoad description[] = {
113 void LoadCheck(
LoggedChange *lc)
const override { this->Load(lc); }
118 inline static const SaveLoad description[] = {
136 void LoadCheck(
LoggedChange *lc)
const override { this->Load(lc); }
141 inline static const SaveLoad description[] = {
158 void LoadCheck(
LoggedChange *lc)
const override { this->Load(lc); }
163 inline static const SaveLoad description[] = {
181 void LoadCheck(
LoggedChange *lc)
const override { this->Load(lc); }
186 inline static const SaveLoad description[] = {
203 void LoadCheck(
LoggedChange *lc)
const override { this->Load(lc); }
208 inline static const SaveLoad description[] = {
226 void LoadCheck(
LoggedChange *lc)
const override { this->Load(lc); }
231 inline static const SaveLoad description[] = {
250 void LoadCheck(
LoggedChange *lc)
const override { this->Load(lc); }
253 static bool _is_emergency_save =
true;
258 inline static const SaveLoad description[] = {
267 _is_emergency_save =
true;
278 void LoadCheck(
LoggedChange *lc)
const override { this->Load(lc); }
283 inline static const SaveLoad description[] = {
321 memset(lc, 0,
sizeof(*lc));
332 for (
size_t i = 0; i < length; i++) {
334 memset(lc, 0,
sizeof(*lc));
341 void LoadCheck(
LoggedAction *la)
const override { this->Load(la); }
344 static const SaveLoad _gamelog_desc[] = {
353 void LoadCommon(
LoggedAction *&gamelog_action, uint &gamelog_actions)
const
355 assert(gamelog_action ==
nullptr);
356 assert(gamelog_actions == 0);
365 gamelog_action =
ReallocT(gamelog_action, gamelog_actions + 1);
367 memset(la, 0,
sizeof(*la));
376 gamelog_action =
ReallocT(gamelog_action, gamelog_actions + 1);
378 memset(la, 0,
sizeof(*la));
@ GLCT_GRFADD
Removed GRF.
@ GLCT_GRFBUG
GRF bug triggered.
uint32 newgrf
_openttd_newgrf_version
char * name
name of the setting
Default handler for saving/loading an object to/from disk.
@ SLV_RIFF_TO_ARRAY
294 PR#9375 Changed many CH_RIFF chunks to CH_ARRAY chunks.
void LoadCheck(size_t) const override
Load the chunk for game preview.
byte mode
new game mode - Editor x Game
const SaveLoadCompat _gamelog_grfmove_sl_compat[]
Original field order for SlGamelogGrfmove.
const SaveLoadCompat _gamelog_grfadd_sl_compat[]
Original field order for SlGamelogGrfadd.
int32 offset
offset, positive = move down
struct LoggedAction * gamelog_action
Gamelog actions.
const SaveLoadCompat _gamelog_action_sl_compat[]
Original field order for SlGamelogAction.
@ GLCT_GRFMOVE
GRF order changed.
std::reference_wrapper< const ChunkHandler > ChunkHandlerRef
A reference to ChunkHandler.
uint32 type
type of savegame,
uint _gamelog_actions
number of actions
LoadCheckData _load_check_data
Data loaded from save during SL_LOAD_CHECK.
@ GLCT_EMERGENCY
Emergency savegame.
#define SLE_CONDVAR(base, variable, type, from, to)
Storage of a variable in some savegame versions.
#define SLE_STR(base, variable, type, length)
Storage of a string in every savegame version.
SaveLoadTable GetLoadDescription() const
Get the description for how to load the chunk.
@ GLCT_REVISION
Changed game revision string.
void Load() const override
Load the chunk.
ChunkType type
Type of the chunk.
GamelogActionType at
Type of action.
Handlers and description of chunk.
byte landscape
landscape (temperate, arctic, ...)
#define SLE_ARR(base, variable, type, length)
Storage of fixed-size array of SL_VAR elements in every version of a savegame.
const SaveLoadCompat _gamelog_mode_sl_compat[]
Original field order for SlGamelogMode.
uint32 changes
Number of changes in this action.
A trimmed down version of what std::span will be in C++20.
const SaveLoadCompat _gamelog_grfbug_sl_compat[]
Original field order for SlGamelogGrfbug.
uint gamelog_actions
Number of gamelog actions.
#define SLE_SAVEBYTE(base, variable)
Only write byte during saving; never read it during loading.
@ GLAT_NONE
No logging active; in savegames, end of list.
byte modified
_openttd_revision_modified
uint64 data
additional data
const SaveLoadCompat _gamelog_emergency_sl_compat[]
Original field order for SlGamelogEmergency.
static bool IsSavegameVersionBefore(SaveLoadVersion major, byte minor=0)
Checks whether the savegame is below major.
GamelogChangeType
Type of logged change.
const SaveLoadCompat _gamelog_sl_compat[]
Original field order for _gamelog_desc.
const SaveLoadCompat _gamelog_grfcompat_sl_compat[]
Original field order for SlGamelogGrfcompat.
@ GLCT_NONE
In savegames, end of list.
LoggedChange * change
First logged change in this action.
@ GLCT_GRFCOMPAT
Loading compatible GRF.
LoggedAction * _gamelog_action
first logged action
size_t SlGetStructListLength(size_t limit)
Get the length of this list; if it exceeds the limit, error out.
const SaveLoadCompat _gamelog_setting_sl_compat[]
Original field order for SlGamelogSetting.
uint32 grfid
ID of removed GRF.
@ SL_MAX_VERSION
Highest possible saveload version.
const SaveLoadCompat _gamelog_oldver_sl_compat[]
Original field order for SlGamelogOldver.
#define SLE_VAR(base, variable, type)
Storage of a variable in every version of a savegame.
GamelogChangeType ct
Type of change logged in this struct.
const SaveLoadCompat _gamelog_revision_sl_compat[]
Original field order for SlGamelogRevision.
#define SLEG_CONDVAR(name, variable, type, from, to)
Storage of a global variable in some savegame versions.
@ GLCT_GRFPARAM
GRF parameter changed.
void NORETURN SlErrorCorrupt(const char *msg)
Error handler for corrupt savegames.
SaveLoadTable GetDescription() const override
@ GLCT_END
So we know how many GLCTs are there.
byte SlReadByte()
Wrapper for reading a byte from the buffer.
@ GLCT_OLDVER
Loaded from savegame without logged data.
static T * ReallocT(T *t_ptr, size_t num_elements)
Simplified reallocation function that allocates the specified number of elements of the given type.
@ GLAT_END
So we know how many GLATs are there.
char text[GAMELOG_REVISION_LENGTH]
revision string, _openttd_revision
std::vector< SaveLoad > SlCompatTableHeader(const SaveLoadTable &slt, const SaveLoadCompatTable &slct)
Load a table header in a savegame compatible way.
void Save() const override
Save the chunk.
@ GLCT_SETTING
Non-networksafe setting value changed.
const SaveLoadCompat _gamelog_grfparam_sl_compat[]
Original field order for SlGamelogGrfparam.
void SlObject(void *object, const SaveLoadTable &slt)
Main SaveLoad function.
std::vector< SaveLoad > SlTableHeader(const SaveLoadTable &slt)
Save or Load a table header.
Contains information about one logged change.
void SlSetStructListLength(size_t length)
Set the length of this list.
@ GLCT_MODE
Scenario editor x Game, different landscape.
GamelogActionType
The actions we log.
const SaveLoadCompat _gamelog_grfrem_sl_compat[]
Original field order for SlGamelogGrfrem.
int SlIterateArray()
Iterate through the elements of an array and read the whole thing.
Contains information about one logged action that caused at least one logged change.
uint32 version
major and minor version OR ttdp version
#define SLEG_STRUCTLIST(name, handler)
Storage of a list of structs in every savegame version.
#define SLEG_STRUCT(name, handler)
Storage of a structs in every savegame version.