(svn r11004) -Codechange: some reworks of the saveload mechanism to be able to save and load private and protected variables in the vehicle struct.

This commit is contained in:
rubidium
2007-08-30 13:09:44 +00:00
parent cb7eaff353
commit 9b65bc430c
8 changed files with 54 additions and 49 deletions

View File

@@ -160,15 +160,15 @@ enum VarTypes {
typedef uint32 VarType;
enum SaveLoadTypes {
SL_VAR = 0,
SL_REF = 1,
SL_ARR = 2,
SL_STR = 3,
SL_LST = 4,
SL_VAR = 0,
SL_REF = 1,
SL_ARR = 2,
SL_STR = 3,
SL_LST = 4,
// non-normal save-load types
SL_WRITEBYTE = 8,
SL_INCLUDE = 9,
SL_END = 15
SL_WRITEBYTE = 8,
SL_VEH_INCLUDE = 9,
SL_END = 15
};
typedef byte SaveLoadType;
@@ -209,8 +209,6 @@ typedef SaveLoad SaveLoadGlobVarList;
/* Translate values ingame to different values in the savegame and vv */
#define SLE_WRITEBYTE(base, variable, value) SLE_GENERAL(SL_WRITEBYTE, base, variable, 0, 0, value, value)
/* Load common code and put it into each struct (currently only for vehicles */
#define SLE_INCLUDE(base, variable, include_index) SLE_GENERAL(SL_INCLUDE, base, variable, 0, 0, include_index, 0)
/* The same as the ones at the top, only the offset is given directly; used for unions */
#define SLE_GENERALX(cmd, offset, type, param1, param2) {false, cmd, type, 0, param1, param2, (void*)(offset)}
@@ -221,7 +219,7 @@ typedef SaveLoad SaveLoadGlobVarList;
#define SLE_REFX(offset, type) SLE_CONDREFX(offset, type, 0, SL_MAX_VERSION)
#define SLE_WRITEBYTEX(offset, something) SLE_GENERALX(SL_WRITEBYTE, offset, 0, something, 0)
#define SLE_INCLUDEX(offset, type) SLE_GENERALX(SL_INCLUDE, offset, type, 0, SL_MAX_VERSION)
#define SLE_VEH_INCLUDEX() SLE_GENERALX(SL_VEH_INCLUDE, 0, 0, 0, SL_MAX_VERSION)
/* End marker */
#define SLE_END() {false, SL_END, 0, 0, 0, 0, NULL}