diff options
author | Darkvater <Darkvater@openttd.org> | 2006-11-21 20:20:30 +0000 |
---|---|---|
committer | Darkvater <Darkvater@openttd.org> | 2006-11-21 20:20:30 +0000 |
commit | fc5ad192584f8c7acaa633d2d47c34e615add406 (patch) | |
tree | 3b7a4d2f64eb443f7020e29b653b70318daf4aba /saveload.h | |
parent | 3445dab1124ed5cc296daf46bd722f5c203032af (diff) | |
download | openttd-fc5ad192584f8c7acaa633d2d47c34e615add406.tar.xz |
(svn r7231) -Codechange: rename ini_get_variable to GetVariableAddress for use both in settings.c
and saveload.c
Diffstat (limited to 'saveload.h')
-rw-r--r-- | saveload.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/saveload.h b/saveload.h index 3a0a59010..56c3a314d 100644 --- a/saveload.h +++ b/saveload.h @@ -271,6 +271,15 @@ static inline VarType GetVarFileType(VarType type) return type & 0xF; // GB(type, 0, 4); } +/** Get the address of the variable. Which one to pick depends on the object + * pointer. If it is NULL we are dealing with global variables so the address + * is taken. If non-null only the offset is stored in the union and we need + * to add this to the address of the object */ +static inline void *GetVariableAddress(const void *object, const SaveLoad *sld) +{ + return (byte*)object + (ptrdiff_t)sld->address; +} + int64 ReadValue(const void *ptr, VarType conv); void WriteValue(void *ptr, VarType conv, int64 val); |