diff options
author | Nikolay Korolev <nickvnuk@gmail.com> | 2020-05-14 21:29:23 +0200 |
---|---|---|
committer | Nikolay Korolev <nickvnuk@gmail.com> | 2020-05-14 21:29:23 +0200 |
commit | 09a0207e55ac8a69639c85997c330ec0f7caf4a6 (patch) | |
tree | f7784f9199ee39054ca94a1f6cf5de880c7c243f /src/weapons/Weapon.cpp | |
parent | more pedattractor (diff) | |
parent | Fix compilation (diff) | |
download | re3-09a0207e55ac8a69639c85997c330ec0f7caf4a6.tar re3-09a0207e55ac8a69639c85997c330ec0f7caf4a6.tar.gz re3-09a0207e55ac8a69639c85997c330ec0f7caf4a6.tar.bz2 re3-09a0207e55ac8a69639c85997c330ec0f7caf4a6.tar.lz re3-09a0207e55ac8a69639c85997c330ec0f7caf4a6.tar.xz re3-09a0207e55ac8a69639c85997c330ec0f7caf4a6.tar.zst re3-09a0207e55ac8a69639c85997c330ec0f7caf4a6.zip |
Diffstat (limited to 'src/weapons/Weapon.cpp')
-rw-r--r-- | src/weapons/Weapon.cpp | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/src/weapons/Weapon.cpp b/src/weapons/Weapon.cpp index 8ce39ceb..18c605bc 100644 --- a/src/weapons/Weapon.cpp +++ b/src/weapons/Weapon.cpp @@ -2284,27 +2284,32 @@ CWeapon::ProcessLineOfSight(CVector const &point1, CVector const &point2, CColPo } #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 CWeapon::Save(uint8*& buf) { - WriteSaveBuf<uint32>(buf, m_eWeaponType); - WriteSaveBuf<uint32>(buf, m_eWeaponState); - WriteSaveBuf<uint32>(buf, m_nAmmoInClip); - WriteSaveBuf<uint32>(buf, m_nAmmoTotal); - WriteSaveBuf<uint32>(buf, m_nTimer); - WriteSaveBuf<bool>(buf, m_bAddRotOffset); + CopyToBuf(buf, m_eWeaponType); + CopyToBuf(buf, m_eWeaponState); + CopyToBuf(buf, m_nAmmoInClip); + CopyToBuf(buf, m_nAmmoTotal); + CopyToBuf(buf, m_nTimer); + CopyToBuf(buf, m_bAddRotOffset); SkipSaveBuf(buf, 3); } void CWeapon::Load(uint8*& buf) { - m_eWeaponType = (eWeaponType)ReadSaveBuf<uint32>(buf); - m_eWeaponState = (eWeaponState)ReadSaveBuf<uint32>(buf); - m_nAmmoInClip = ReadSaveBuf<uint32>(buf); - m_nAmmoTotal = ReadSaveBuf<uint32>(buf); - m_nTimer = ReadSaveBuf<uint32>(buf); - m_bAddRotOffset = ReadSaveBuf<bool>(buf); + CopyFromBuf(buf, m_eWeaponType); + CopyFromBuf(buf, m_eWeaponState); + CopyFromBuf(buf, m_nAmmoInClip); + CopyFromBuf(buf, m_nAmmoTotal); + CopyFromBuf(buf, m_nTimer); + CopyFromBuf(buf, m_bAddRotOffset); SkipSaveBuf(buf, 3); } + +#undef CopyFromBuf +#undef CopyToBuf #endif |