src/saveload.h
changeset 10336 9b4b4e1b0668
parent 10207 c291a21b304e
equal deleted inserted replaced
10335:4eccb8a55280 10336:9b4b4e1b0668
    91 
    91 
    92 /** VarTypes is the general bitmasked magic type that tells us
    92 /** VarTypes is the general bitmasked magic type that tells us
    93  * certain characteristics about the variable it refers to. For example
    93  * certain characteristics about the variable it refers to. For example
    94  * SLE_FILE_* gives the size(type) as it would be in the savegame and
    94  * SLE_FILE_* gives the size(type) as it would be in the savegame and
    95  * SLE_VAR_* the size(type) as it is in memory during runtime. These are
    95  * SLE_VAR_* the size(type) as it is in memory during runtime. These are
    96  * the first 8 bytes (0-3 SLE_FILE, 4-7 SLE_VAR).
    96  * the first 8 bits (0-3 SLE_FILE, 4-7 SLE_VAR).
    97  * Bytes 8-15 are reserved for various flags as explained below */
    97  * Bits 8-15 are reserved for various flags as explained below */
    98 enum VarTypes {
    98 enum VarTypes {
    99 	/* 4 bytes allocated a maximum of 16 types for NumberType */
    99 	/* 4 bits allocated a maximum of 16 types for NumberType */
   100 	SLE_FILE_I8       = 0,
   100 	SLE_FILE_I8       = 0,
   101 	SLE_FILE_U8       = 1,
   101 	SLE_FILE_U8       = 1,
   102 	SLE_FILE_I16      = 2,
   102 	SLE_FILE_I16      = 2,
   103 	SLE_FILE_U16      = 3,
   103 	SLE_FILE_U16      = 3,
   104 	SLE_FILE_I32      = 4,
   104 	SLE_FILE_I32      = 4,
   107 	SLE_FILE_U64      = 7,
   107 	SLE_FILE_U64      = 7,
   108 	SLE_FILE_STRINGID = 8, ///< StringID offset into strings-array
   108 	SLE_FILE_STRINGID = 8, ///< StringID offset into strings-array
   109 	SLE_FILE_STRING   = 9,
   109 	SLE_FILE_STRING   = 9,
   110 	/* 6 more possible file-primitives */
   110 	/* 6 more possible file-primitives */
   111 
   111 
   112 	/* 4 bytes allocated a maximum of 16 types for NumberType */
   112 	/* 4 bits allocated a maximum of 16 types for NumberType */
   113 	SLE_VAR_BL    =  0 << 4,
   113 	SLE_VAR_BL    =  0 << 4,
   114 	SLE_VAR_I8    =  1 << 4,
   114 	SLE_VAR_I8    =  1 << 4,
   115 	SLE_VAR_U8    =  2 << 4,
   115 	SLE_VAR_U8    =  2 << 4,
   116 	SLE_VAR_I16   =  3 << 4,
   116 	SLE_VAR_I16   =  3 << 4,
   117 	SLE_VAR_U16   =  4 << 4,
   117 	SLE_VAR_U16   =  4 << 4,
   123 	SLE_VAR_STRB  = 10 << 4, ///< string (with pre-allocated buffer)
   123 	SLE_VAR_STRB  = 10 << 4, ///< string (with pre-allocated buffer)
   124 	SLE_VAR_STRBQ = 11 << 4, ///< string enclosed in quotes (with pre-allocated buffer)
   124 	SLE_VAR_STRBQ = 11 << 4, ///< string enclosed in quotes (with pre-allocated buffer)
   125 	SLE_VAR_STR   = 12 << 4, ///< string pointer
   125 	SLE_VAR_STR   = 12 << 4, ///< string pointer
   126 	SLE_VAR_STRQ  = 13 << 4, ///< string pointer enclosed in quotes
   126 	SLE_VAR_STRQ  = 13 << 4, ///< string pointer enclosed in quotes
   127 	SLE_VAR_NAME  = 14 << 4, ///< old custom name to be converted to a char pointer
   127 	SLE_VAR_NAME  = 14 << 4, ///< old custom name to be converted to a char pointer
   128 	/* 2 more possible memory-primitives */
   128 	/* 1 more possible memory-primitives */
   129 
   129 
   130 	/* Shortcut values */
   130 	/* Shortcut values */
   131 	SLE_VAR_CHAR = SLE_VAR_I8,
   131 	SLE_VAR_CHAR = SLE_VAR_I8,
   132 
   132 
   133 	/* Default combinations of variables. As savegames change, so can variables
   133 	/* Default combinations of variables. As savegames change, so can variables
   156 	SLE_STRB  = SLE_STRINGBUF,
   156 	SLE_STRB  = SLE_STRINGBUF,
   157 	SLE_STRBQ = SLE_STRINGBQUOTE,
   157 	SLE_STRBQ = SLE_STRINGBQUOTE,
   158 	SLE_STR   = SLE_STRING,
   158 	SLE_STR   = SLE_STRING,
   159 	SLE_STRQ  = SLE_STRINGQUOTE,
   159 	SLE_STRQ  = SLE_STRINGQUOTE,
   160 
   160 
   161 	/* 8 bytes allocated for a maximum of 8 flags
   161 	/* 8 bits allocated for a maximum of 8 flags
   162 	 * Flags directing saving/loading of a variable */
   162 	 * Flags directing saving/loading of a variable */
   163 	SLF_SAVE_NO      = 1 <<  8, ///< do not save with savegame, basically client-based
   163 	SLF_SAVE_NO      = 1 <<  8, ///< do not save with savegame, basically client-based
   164 	SLF_CONFIG_NO    = 1 <<  9, ///< do not save to config file
   164 	SLF_CONFIG_NO    = 1 <<  9, ///< do not save to config file
   165 	SLF_NETWORK_NO   = 1 << 10, ///< do not synchronize over network (but it is saved if SSF_SAVE_NO is not set)
   165 	SLF_NETWORK_NO   = 1 << 10, ///< do not synchronize over network (but it is saved if SSF_SAVE_NO is not set)
   166 	/* 5 more possible flags */
   166 	/* 5 more possible flags */