summaryrefslogtreecommitdiff
path: root/saveload.h
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2006-03-01 20:34:51 +0000
committerDarkvater <darkvater@openttd.org>2006-03-01 20:34:51 +0000
commit01c371fe0e6d5c1d00972bb2797d84f2cb7d8ae0 (patch)
tree3cff3fd1b370abaafd1dfa9ffa649250f8c97367 /saveload.h
parent61b43672e936091fed73ea7d7ccf8dfbdb46e6ab (diff)
downloadopenttd-01c371fe0e6d5c1d00972bb2797d84f2cb7d8ae0.tar.xz
(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
Diffstat (limited to 'saveload.h')
-rw-r--r--saveload.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/saveload.h b/saveload.h
index 972953a1e..ed5362a85 100644
--- a/saveload.h
+++ b/saveload.h
@@ -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);