diff options
author | Sergeanur <s.anureev@yandex.ua> | 2020-05-13 15:24:00 +0200 |
---|---|---|
committer | Sergeanur <s.anureev@yandex.ua> | 2020-05-13 15:24:00 +0200 |
commit | 3f1001b86bffe6c5de8b7c6ce047d0f2bc3472b4 (patch) | |
tree | 7751883d8ad7cdab3854af08005d2bb70b4215f3 /src/peds/PlayerPed.cpp | |
parent | car control and cranes fixes (diff) | |
download | re3-3f1001b86bffe6c5de8b7c6ce047d0f2bc3472b4.tar re3-3f1001b86bffe6c5de8b7c6ce047d0f2bc3472b4.tar.gz re3-3f1001b86bffe6c5de8b7c6ce047d0f2bc3472b4.tar.bz2 re3-3f1001b86bffe6c5de8b7c6ce047d0f2bc3472b4.tar.lz re3-3f1001b86bffe6c5de8b7c6ce047d0f2bc3472b4.tar.xz re3-3f1001b86bffe6c5de8b7c6ce047d0f2bc3472b4.tar.zst re3-3f1001b86bffe6c5de8b7c6ce047d0f2bc3472b4.zip |
Diffstat (limited to '')
-rw-r--r-- | src/peds/PlayerPed.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/peds/PlayerPed.cpp b/src/peds/PlayerPed.cpp index 92e3d358..3c6fad57 100644 --- a/src/peds/PlayerPed.cpp +++ b/src/peds/PlayerPed.cpp @@ -1513,17 +1513,19 @@ CPlayerPed::ProcessControl(void) } #ifdef COMPATIBLE_SAVES +#define CopyFromBuf(buf, data) memcpy(&data, buf, sizeof(data)); SkipSaveBuf(buf, sizeof(data)); +#define CopyToBuf(buf, data) memcpy(buf, &data, sizeof(data)); SkipSaveBuf(buf, sizeof(data)); void CPlayerPed::Save(uint8*& buf) { CPed::Save(buf); SkipSaveBuf(buf, 16); - WriteSaveBuf<float>(buf, m_fMaxStamina); + CopyToBuf(buf, m_fMaxStamina); SkipSaveBuf(buf, 28); - WriteSaveBuf<int32>(buf, m_nTargettableObjects[0]); - WriteSaveBuf<int32>(buf, m_nTargettableObjects[1]); - WriteSaveBuf<int32>(buf, m_nTargettableObjects[2]); - WriteSaveBuf<int32>(buf, m_nTargettableObjects[3]); + CopyToBuf(buf, m_nTargettableObjects[0]); + CopyToBuf(buf, m_nTargettableObjects[1]); + CopyToBuf(buf, m_nTargettableObjects[2]); + CopyToBuf(buf, m_nTargettableObjects[3]); SkipSaveBuf(buf, 116); } @@ -1532,12 +1534,14 @@ CPlayerPed::Load(uint8*& buf) { CPed::Load(buf); SkipSaveBuf(buf, 16); - m_fMaxStamina = ReadSaveBuf<float>(buf); + CopyFromBuf(buf, m_fMaxStamina); SkipSaveBuf(buf, 28); - m_nTargettableObjects[0] = ReadSaveBuf<int32>(buf); - m_nTargettableObjects[1] = ReadSaveBuf<int32>(buf); - m_nTargettableObjects[2] = ReadSaveBuf<int32>(buf); - m_nTargettableObjects[3] = ReadSaveBuf<int32>(buf); + CopyFromBuf(buf, m_nTargettableObjects[0]); + CopyFromBuf(buf, m_nTargettableObjects[1]); + CopyFromBuf(buf, m_nTargettableObjects[2]); + CopyFromBuf(buf, m_nTargettableObjects[3]); SkipSaveBuf(buf, 116); } +#undef CopyFromBuf +#undef CopyToBuf #endif |