src/saveload.h
changeset 6810 cf93b22233ea
parent 6499 e46cf40d8743
child 6817 ca1cc2fd4cfa
equal deleted inserted replaced
6809:0f306c3e1030 6810:cf93b22233ea
   159 	SL_REF       =  1,
   159 	SL_REF       =  1,
   160 	SL_ARR       =  2,
   160 	SL_ARR       =  2,
   161 	SL_STR       =  3,
   161 	SL_STR       =  3,
   162 	SL_LST       =  4,
   162 	SL_LST       =  4,
   163 	// non-normal save-load types
   163 	// non-normal save-load types
   164 	SL_WRITEBYTE =  8,
       
   165 	SL_INCLUDE   =  9,
   164 	SL_INCLUDE   =  9,
   166 	SL_END       = 15
   165 	SL_END       = 15
   167 };
   166 };
   168 
   167 
   169 typedef byte SaveLoadType;
   168 typedef byte SaveLoadType;
   199 #define SLE_STR(base, variable, type, length) SLE_CONDSTR(base, variable, type, length, 0, SL_MAX_VERSION)
   198 #define SLE_STR(base, variable, type, length) SLE_CONDSTR(base, variable, type, length, 0, SL_MAX_VERSION)
   200 #define SLE_LST(base, variable, type) SLE_CONDLST(base, variable, type, 0, SL_MAX_VERSION)
   199 #define SLE_LST(base, variable, type) SLE_CONDLST(base, variable, type, 0, SL_MAX_VERSION)
   201 
   200 
   202 #define SLE_CONDNULL(length, from, to) SLE_CONDARR(NullStruct, null, SLE_FILE_U8 | SLE_VAR_NULL | SLF_CONFIG_NO, length, from, to)
   201 #define SLE_CONDNULL(length, from, to) SLE_CONDARR(NullStruct, null, SLE_FILE_U8 | SLE_VAR_NULL | SLF_CONFIG_NO, length, from, to)
   203 
   202 
   204 /* Translate values ingame to different values in the savegame and vv */
       
   205 #define SLE_WRITEBYTE(base, variable, game_value, file_value) SLE_GENERAL(SL_WRITEBYTE, base, variable, 0, 0, game_value, file_value)
       
   206 /* Load common code and put it into each struct (currently only for vehicles */
   203 /* Load common code and put it into each struct (currently only for vehicles */
   207 #define SLE_INCLUDE(base, variable, include_index) SLE_GENERAL(SL_INCLUDE, base, variable, 0, 0, include_index, 0)
   204 #define SLE_INCLUDE(base, variable, include_index) SLE_GENERAL(SL_INCLUDE, base, variable, 0, 0, include_index, 0)
   208 
   205 
   209 /* The same as the ones at the top, only the offset is given directly; used for unions */
   206 /* The same as the ones at the top, only the offset is given directly; used for unions */
   210 #define SLE_GENERALX(cmd, offset, type, param1, param2) {cmd, type, 0, param1, param2, (void*)(offset)}
   207 #define SLE_GENERALX(cmd, offset, type, param1, param2) {cmd, type, 0, param1, param2, (void*)(offset)}
   212 #define SLE_CONDREFX(offset, type, from, to) SLE_GENERALX(SL_REF, offset, type, from, to)
   209 #define SLE_CONDREFX(offset, type, from, to) SLE_GENERALX(SL_REF, offset, type, from, to)
   213 
   210 
   214 #define SLE_VARX(offset, type) SLE_CONDVARX(offset, type, 0, SL_MAX_VERSION)
   211 #define SLE_VARX(offset, type) SLE_CONDVARX(offset, type, 0, SL_MAX_VERSION)
   215 #define SLE_REFX(offset, type) SLE_CONDREFX(offset, type, 0, SL_MAX_VERSION)
   212 #define SLE_REFX(offset, type) SLE_CONDREFX(offset, type, 0, SL_MAX_VERSION)
   216 
   213 
   217 #define SLE_WRITEBYTEX(offset, something) SLE_GENERALX(SL_WRITEBYTE, offset, 0, something, 0)
       
   218 #define SLE_INCLUDEX(offset, type) SLE_GENERALX(SL_INCLUDE, offset, type, 0, SL_MAX_VERSION)
   214 #define SLE_INCLUDEX(offset, type) SLE_GENERALX(SL_INCLUDE, offset, type, 0, SL_MAX_VERSION)
   219 
   215 
   220 /* End marker */
   216 /* End marker */
   221 #define SLE_END() {SL_END, 0, 0, 0, 0, NULL}
   217 #define SLE_END() {SL_END, 0, 0, 0, 0, NULL}
   222 
   218