src/saveload.h
changeset 10775 7061477bfbcf
parent 10751 ebd94f2d6385
child 10824 1a34ba6f338a
equal deleted inserted replaced
10773:88125a991761 10775:7061477bfbcf
   302  * pointer. If it is NULL we are dealing with global variables so the address
   302  * pointer. If it is NULL we are dealing with global variables so the address
   303  * is taken. If non-null only the offset is stored in the union and we need
   303  * is taken. If non-null only the offset is stored in the union and we need
   304  * to add this to the address of the object */
   304  * to add this to the address of the object */
   305 static inline void *GetVariableAddress(const void *object, const SaveLoad *sld)
   305 static inline void *GetVariableAddress(const void *object, const SaveLoad *sld)
   306 {
   306 {
   307 	return (byte*)object + (ptrdiff_t)sld->address;
   307 	return (byte*)(sld->global ? NULL : object) + (ptrdiff_t)sld->address;
   308 }
   308 }
   309 
   309 
   310 int64 ReadValue(const void *ptr, VarType conv);
   310 int64 ReadValue(const void *ptr, VarType conv);
   311 void WriteValue(void *ptr, VarType conv, int64 val);
   311 void WriteValue(void *ptr, VarType conv, int64 val);
   312 
   312