From fc5ad192584f8c7acaa633d2d47c34e615add406 Mon Sep 17 00:00:00 2001 From: Darkvater Date: Tue, 21 Nov 2006 20:20:30 +0000 Subject: (svn r7231) -Codechange: rename ini_get_variable to GetVariableAddress for use both in settings.c and saveload.c --- saveload.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'saveload.h') 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); -- cgit v1.2.3-54-g00ecf