summaryrefslogtreecommitdiffstats
path: root/src/peds/Ped.cpp
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2020-05-13 15:24:00 +0200
committerSergeanur <s.anureev@yandex.ua>2020-05-13 15:24:00 +0200
commit3f1001b86bffe6c5de8b7c6ce047d0f2bc3472b4 (patch)
tree7751883d8ad7cdab3854af08005d2bb70b4215f3 /src/peds/Ped.cpp
parentcar control and cranes fixes (diff)
downloadre3-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/Ped.cpp32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index f4e99d4d..d261385a 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -17738,23 +17738,25 @@ CPed::SetExitBoat(CVehicle *boat)
}
#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
CPed::Save(uint8*& buf)
{
SkipSaveBuf(buf, 52);
- WriteSaveBuf<float>(buf, GetPosition().x);
- WriteSaveBuf<float>(buf, GetPosition().y);
- WriteSaveBuf<float>(buf, GetPosition().z);
+ CopyToBuf(buf, GetPosition().x);
+ CopyToBuf(buf, GetPosition().y);
+ CopyToBuf(buf, GetPosition().z);
SkipSaveBuf(buf, 288);
- WriteSaveBuf<uint8>(buf, CharCreatedBy);
+ CopyToBuf(buf, CharCreatedBy);
SkipSaveBuf(buf, 351);
- WriteSaveBuf<float>(buf, m_fHealth);
- WriteSaveBuf<float>(buf, m_fArmour);
+ CopyToBuf(buf, m_fHealth);
+ CopyToBuf(buf, m_fArmour);
SkipSaveBuf(buf, 148);
for (int i = 0; i < 13; i++) // has to be hardcoded
m_weapons[i].Save(buf);
SkipSaveBuf(buf, 5);
- WriteSaveBuf<uint8>(buf, m_maxWeaponTypeAllowed);
+ CopyToBuf(buf, m_maxWeaponTypeAllowed);
SkipSaveBuf(buf, 162);
}
@@ -17762,19 +17764,21 @@ void
CPed::Load(uint8*& buf)
{
SkipSaveBuf(buf, 52);
- GetMatrix().GetPosition().x = ReadSaveBuf<float>(buf);
- GetMatrix().GetPosition().y = ReadSaveBuf<float>(buf);
- GetMatrix().GetPosition().z = ReadSaveBuf<float>(buf);
+ CopyFromBuf(buf, GetMatrix().GetPosition().x);
+ CopyFromBuf(buf, GetMatrix().GetPosition().y);
+ CopyFromBuf(buf, GetMatrix().GetPosition().z);
SkipSaveBuf(buf, 288);
- CharCreatedBy = ReadSaveBuf<uint8>(buf);
+ CopyFromBuf(buf, CharCreatedBy);
SkipSaveBuf(buf, 351);
- m_fHealth = ReadSaveBuf<float>(buf);
- m_fArmour = ReadSaveBuf<float>(buf);
+ CopyFromBuf(buf, m_fHealth);
+ CopyFromBuf(buf, m_fArmour);
SkipSaveBuf(buf, 148);
for (int i = 0; i < 13; i++) // has to be hardcoded
m_weapons[i].Load(buf);
SkipSaveBuf(buf, 5);
- m_maxWeaponTypeAllowed = ReadSaveBuf<uint8>(buf);
+ CopyFromBuf(buf, m_maxWeaponTypeAllowed);
SkipSaveBuf(buf, 162);
}
+#undef CopyFromBuf
+#undef CopyToBuf
#endif