1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-13 17:49:10 +00:00

(svn r3711) - Extract the WriteValue() and ReadValue() parts of the saveload code to assign/read to/from a variable. Preparatory work to make this the general function type for such assignments

This commit is contained in:
Darkvater
2006-03-01 20:34:51 +00:00
parent 61b43672e9
commit 01c371fe0e
2 changed files with 83 additions and 37 deletions

View File

@@ -217,6 +217,27 @@ static inline bool CheckSavegameVersion(uint16 version)
return _sl_version < version;
}
/* Get the NumberType of a setting. This describes the integer type
* as it is represented in memory
* @param type VarType holding information about the variable-type
* @return return the SLE_VAR_* part of a variable-type description */
static inline VarType GetVarMemType(VarType type)
{
return type & 0xF0; // GB(type, 4, 8) << 4;
}
/* Get the FileType of a setting. This describes the integer type
* as it is represented in a savegame/file
* @param type VarType holding information about the variable-type
* @param return the SLE_FILE_* part of a variable-type description */
static inline VarType GetVarFileType(VarType type)
{
return type & 0xF; // GB(type, 0, 4);
}
int64 ReadValue(const void *ptr, VarType conv);
void WriteValue(void *ptr, VarType conv, int64 val);
void SlSetArrayIndex(uint index);
int SlIterateArray(void);