diff options
author | erorcun <erorcunerorcun@hotmail.com.tr> | 2021-06-25 23:25:59 +0200 |
---|---|---|
committer | erorcun <erorcunerorcun@hotmail.com.tr> | 2021-06-25 23:25:59 +0200 |
commit | af7573ddbe38e0aaa485877e7ccb2e704b0f5a7f (patch) | |
tree | 75a719bb1ab82b354f464562ecc1fae9c55f64d0 /src/save/SaveBuf.h | |
parent | Merge pull request #1147 from withmorten/githash (diff) | |
download | re3-af7573ddbe38e0aaa485877e7ccb2e704b0f5a7f.tar re3-af7573ddbe38e0aaa485877e7ccb2e704b0f5a7f.tar.gz re3-af7573ddbe38e0aaa485877e7ccb2e704b0f5a7f.tar.bz2 re3-af7573ddbe38e0aaa485877e7ccb2e704b0f5a7f.tar.lz re3-af7573ddbe38e0aaa485877e7ccb2e704b0f5a7f.tar.xz re3-af7573ddbe38e0aaa485877e7ccb2e704b0f5a7f.tar.zst re3-af7573ddbe38e0aaa485877e7ccb2e704b0f5a7f.zip |
Diffstat (limited to '')
-rw-r--r-- | src/save/SaveBuf.h | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/src/save/SaveBuf.h b/src/save/SaveBuf.h deleted file mode 100644 index ed48a650..00000000 --- a/src/save/SaveBuf.h +++ /dev/null @@ -1,64 +0,0 @@ -#pragma once - -#ifdef VALIDATE_SAVE_SIZE -extern int32 _saveBufCount; -#define INITSAVEBUF _saveBufCount = 0; -#define VALIDATESAVEBUF(b) assert(_saveBufCount == b); -#else -#define INITSAVEBUF -#define VALIDATESAVEBUF(b) -#endif - -inline void -SkipSaveBuf(uint8 *&buf, int32 skip) -{ - buf += skip; -#ifdef VALIDATE_SAVE_SIZE - _saveBufCount += skip; -#endif -} - -template <typename T> -inline void -ReadSaveBuf(T* out, uint8 *&buf) -{ - *out = *(T *)buf; - SkipSaveBuf(buf, sizeof(T)); -} - -template <typename T> -inline T * -WriteSaveBuf(uint8 *&buf, const T &value) -{ - T *p = (T *)buf; - *p = value; - SkipSaveBuf(buf, sizeof(T)); - return p; -} - -#define SAVE_HEADER_SIZE (4 * sizeof(char) + sizeof(uint32)) - -#define WriteSaveHeader(buf, a, b, c, d, size) \ - WriteSaveBuf(buf, a); \ - WriteSaveBuf(buf, b); \ - WriteSaveBuf(buf, c); \ - WriteSaveBuf(buf, d); \ - WriteSaveBuf(buf, (uint32)size); - -#ifdef VALIDATE_SAVE_SIZE -#define CheckSaveHeader(buf, a, b, c, d, size) { \ - char _C; uint32 _size;\ - ReadSaveBuf(&_C, buf);\ - assert(_C == a);\ - ReadSaveBuf(&_C, buf);\ - assert(_C == b);\ - ReadSaveBuf(&_C, buf);\ - assert(_C == c);\ - ReadSaveBuf(&_C, buf);\ - assert(_C == d);\ - ReadSaveBuf(&_size, buf);\ - assert(_size == size);\ - } -#else -#define CheckSaveHeader(buf, a, b, c, d, size) SkipSaveBuf(buf, 8); -#endif
\ No newline at end of file |