From 8eed6ae1794989eb15fe95d867c44c196080c4dd Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Fri, 8 Jan 2021 21:50:59 +0200 Subject: Use original names --- src/core/Pools.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/Pools.cpp') diff --git a/src/core/Pools.cpp b/src/core/Pools.cpp index 79841c14..d3801a2a 100644 --- a/src/core/Pools.cpp +++ b/src/core/Pools.cpp @@ -485,7 +485,7 @@ INITSAVEBUF #endif CopyToBuf(buf, CWanted::MaximumWantedLevel); CopyToBuf(buf, CWanted::nMaximumWantedLevel); - memcpy(buf, CModelInfo::GetModelInfo(pPed->GetModelIndex())->GetName(), MAX_MODEL_NAME); + memcpy(buf, CModelInfo::GetModelInfo(pPed->GetModelIndex())->GetModelName(), MAX_MODEL_NAME); SkipSaveBuf(buf, MAX_MODEL_NAME); } } -- cgit v1.2.3 From a9b8d30ce0e4e40dc5b5410c85bd0987548c6772 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Tue, 19 Jan 2021 21:32:55 +0200 Subject: Get rid of bitfields in CPool --- src/core/Pools.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/Pools.cpp') diff --git a/src/core/Pools.cpp b/src/core/Pools.cpp index d3801a2a..39cfb1d4 100644 --- a/src/core/Pools.cpp +++ b/src/core/Pools.cpp @@ -102,7 +102,7 @@ CPools::CheckPoolsEmpty() void CPools::MakeSureSlotInObjectPoolIsEmpty(int32 slot) { - if (ms_pObjectPool->IsFreeSlot(slot)) return; + if (ms_pObjectPool->GetIsFree(slot)) return; CObject *object = ms_pObjectPool->GetSlot(slot); if (object->ObjectCreatedBy == TEMP_OBJECT) { -- cgit v1.2.3 From 7a3b80a9b7f414967fe59f89ab0fe5416735babe Mon Sep 17 00:00:00 2001 From: Filip Gawin Date: Sun, 31 Jan 2021 20:44:39 +0100 Subject: First batch of fixes (CallAndMessage) --- src/core/Pools.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/core/Pools.cpp') diff --git a/src/core/Pools.cpp b/src/core/Pools.cpp index 39cfb1d4..54055243 100644 --- a/src/core/Pools.cpp +++ b/src/core/Pools.cpp @@ -144,8 +144,11 @@ INITSAVEBUF pVehicle = new(slot) CBoat(model, RANDOM_VEHICLE); else if (type == VEHICLE_TYPE_CAR) pVehicle = new(slot) CAutomobile(model, RANDOM_VEHICLE); - else + else { assert(0); + debug("This shouldn't happen"); + return; + } --CCarCtrl::NumRandomCars; pVehicle->Load(buf); CWorld::Add(pVehicle); @@ -518,8 +521,11 @@ INITSAVEBUF if (pedtype == PEDTYPE_PLAYER1) pPed = new(ref) CPlayerPed(); - else + else { assert(0); + debug("This shouldn't happen"); + return; + } pPed->Load(buf); if (pedtype == PEDTYPE_PLAYER1) { -- cgit v1.2.3 From 3d4791f2915a5b1f38c34a0cf01e0dffc588af8c Mon Sep 17 00:00:00 2001 From: Filip Gawin Date: Sun, 31 Jan 2021 21:06:38 +0100 Subject: Revert "First batch of fixes (CallAndMessage)" This reverts commit 7a3b80a9b7f414967fe59f89ab0fe5416735babe. --- src/core/Pools.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src/core/Pools.cpp') diff --git a/src/core/Pools.cpp b/src/core/Pools.cpp index 54055243..39cfb1d4 100644 --- a/src/core/Pools.cpp +++ b/src/core/Pools.cpp @@ -144,11 +144,8 @@ INITSAVEBUF pVehicle = new(slot) CBoat(model, RANDOM_VEHICLE); else if (type == VEHICLE_TYPE_CAR) pVehicle = new(slot) CAutomobile(model, RANDOM_VEHICLE); - else { + else assert(0); - debug("This shouldn't happen"); - return; - } --CCarCtrl::NumRandomCars; pVehicle->Load(buf); CWorld::Add(pVehicle); @@ -521,11 +518,8 @@ INITSAVEBUF if (pedtype == PEDTYPE_PLAYER1) pPed = new(ref) CPlayerPed(); - else { + else assert(0); - debug("This shouldn't happen"); - return; - } pPed->Load(buf); if (pedtype == PEDTYPE_PLAYER1) { -- cgit v1.2.3 From 2b67aba94cb6448fb24c869559465eddf2bad069 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Fri, 25 Jun 2021 19:03:05 +0300 Subject: Redo ReadSaveBuf + common.h cleanup --- src/core/Pools.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/core/Pools.cpp') diff --git a/src/core/Pools.cpp b/src/core/Pools.cpp index 39cfb1d4..5cffe9e4 100644 --- a/src/core/Pools.cpp +++ b/src/core/Pools.cpp @@ -9,6 +9,7 @@ #endif #include "Population.h" #include "ProjectileInfo.h" +#include "SaveBuf.h" #include "Streaming.h" #include "Wanted.h" #include "World.h" @@ -130,14 +131,19 @@ CPools::MakeSureSlotInObjectPoolIsEmpty(int32 slot) void CPools::LoadVehiclePool(uint8* buf, uint32 size) { INITSAVEBUF - int nNumCars = ReadSaveBuf(buf); - int nNumBoats = ReadSaveBuf(buf); + int nNumCars, nNumBoats; + ReadSaveBuf(&nNumCars, buf); + ReadSaveBuf(&nNumBoats, buf); for (int i = 0; i < nNumCars + nNumBoats; i++) { - uint32 type = ReadSaveBuf(buf); - int16 model = ReadSaveBuf(buf); + uint32 type; + int16 model; + int32 slot; + + ReadSaveBuf(&type, buf); + ReadSaveBuf(&model, buf); CStreaming::RequestModel(model, STREAMFLAGS_DEPENDENCY); CStreaming::LoadAllRequestedModels(false); - int32 slot = ReadSaveBuf(buf); + ReadSaveBuf(&slot, buf); CVehicle* pVehicle; #ifdef COMPATIBLE_SAVES if (type == VEHICLE_TYPE_BOAT) -- cgit v1.2.3 From af7573ddbe38e0aaa485877e7ccb2e704b0f5a7f Mon Sep 17 00:00:00 2001 From: erorcun Date: Sat, 26 Jun 2021 00:25:59 +0300 Subject: Revert "Redo ReadSaveBuf + common.h cleanup" This reverts commit 2b67aba94cb6448fb24c869559465eddf2bad069. --- src/core/Pools.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'src/core/Pools.cpp') diff --git a/src/core/Pools.cpp b/src/core/Pools.cpp index 5cffe9e4..39cfb1d4 100644 --- a/src/core/Pools.cpp +++ b/src/core/Pools.cpp @@ -9,7 +9,6 @@ #endif #include "Population.h" #include "ProjectileInfo.h" -#include "SaveBuf.h" #include "Streaming.h" #include "Wanted.h" #include "World.h" @@ -131,19 +130,14 @@ CPools::MakeSureSlotInObjectPoolIsEmpty(int32 slot) void CPools::LoadVehiclePool(uint8* buf, uint32 size) { INITSAVEBUF - int nNumCars, nNumBoats; - ReadSaveBuf(&nNumCars, buf); - ReadSaveBuf(&nNumBoats, buf); + int nNumCars = ReadSaveBuf(buf); + int nNumBoats = ReadSaveBuf(buf); for (int i = 0; i < nNumCars + nNumBoats; i++) { - uint32 type; - int16 model; - int32 slot; - - ReadSaveBuf(&type, buf); - ReadSaveBuf(&model, buf); + uint32 type = ReadSaveBuf(buf); + int16 model = ReadSaveBuf(buf); CStreaming::RequestModel(model, STREAMFLAGS_DEPENDENCY); CStreaming::LoadAllRequestedModels(false); - ReadSaveBuf(&slot, buf); + int32 slot = ReadSaveBuf(buf); CVehicle* pVehicle; #ifdef COMPATIBLE_SAVES if (type == VEHICLE_TYPE_BOAT) -- cgit v1.2.3 From f3a931e1c99372ae4bc224ef482d4052a09580cb Mon Sep 17 00:00:00 2001 From: withmorten Date: Sat, 26 Jun 2021 19:14:46 +0200 Subject: Revert "Revert "Redo ReadSaveBuf + common.h cleanup"" This reverts commit af7573ddbe38e0aaa485877e7ccb2e704b0f5a7f. --- src/core/Pools.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/core/Pools.cpp') diff --git a/src/core/Pools.cpp b/src/core/Pools.cpp index 39cfb1d4..5cffe9e4 100644 --- a/src/core/Pools.cpp +++ b/src/core/Pools.cpp @@ -9,6 +9,7 @@ #endif #include "Population.h" #include "ProjectileInfo.h" +#include "SaveBuf.h" #include "Streaming.h" #include "Wanted.h" #include "World.h" @@ -130,14 +131,19 @@ CPools::MakeSureSlotInObjectPoolIsEmpty(int32 slot) void CPools::LoadVehiclePool(uint8* buf, uint32 size) { INITSAVEBUF - int nNumCars = ReadSaveBuf(buf); - int nNumBoats = ReadSaveBuf(buf); + int nNumCars, nNumBoats; + ReadSaveBuf(&nNumCars, buf); + ReadSaveBuf(&nNumBoats, buf); for (int i = 0; i < nNumCars + nNumBoats; i++) { - uint32 type = ReadSaveBuf(buf); - int16 model = ReadSaveBuf(buf); + uint32 type; + int16 model; + int32 slot; + + ReadSaveBuf(&type, buf); + ReadSaveBuf(&model, buf); CStreaming::RequestModel(model, STREAMFLAGS_DEPENDENCY); CStreaming::LoadAllRequestedModels(false); - int32 slot = ReadSaveBuf(buf); + ReadSaveBuf(&slot, buf); CVehicle* pVehicle; #ifdef COMPATIBLE_SAVES if (type == VEHICLE_TYPE_BOAT) -- cgit v1.2.3 From 011aafa0435d2c60dc4e0769ed4c93ed1761e3f6 Mon Sep 17 00:00:00 2001 From: withmorten Date: Mon, 5 Jul 2021 18:07:26 +0200 Subject: finish COMPATIBLE_SAVES and FIX_INCOMPATIBLE_SAVES --- src/core/Pools.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/core/Pools.cpp') diff --git a/src/core/Pools.cpp b/src/core/Pools.cpp index 5cffe9e4..b0248664 100644 --- a/src/core/Pools.cpp +++ b/src/core/Pools.cpp @@ -281,9 +281,9 @@ INITSAVEBUF #else if ((pVehicle->IsCar() || pVehicle->IsBoat()) && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) { #endif - WriteSaveBuf(buf, pVehicle->m_vehType); - WriteSaveBuf(buf, pVehicle->GetModelIndex()); - WriteSaveBuf(buf, GetVehicleRef(pVehicle)); + WriteSaveBuf(buf, pVehicle->m_vehType); + WriteSaveBuf(buf, pVehicle->GetModelIndex()); + WriteSaveBuf(buf, GetVehicleRef(pVehicle)); pVehicle->Save(buf); } #else @@ -292,7 +292,7 @@ INITSAVEBUF #else if (pVehicle->IsCar() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) { #endif - WriteSaveBuf(buf, (uint32)pVehicle->m_vehType); + WriteSaveBuf(buf, pVehicle->m_vehType); WriteSaveBuf(buf, pVehicle->GetModelIndex()); WriteSaveBuf(buf, GetVehicleRef(pVehicle)); memcpy(buf, pVehicle, sizeof(CAutomobile)); @@ -303,7 +303,7 @@ INITSAVEBUF #else if (pVehicle->IsBoat() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) { #endif - WriteSaveBuf(buf, (uint32)pVehicle->m_vehType); + WriteSaveBuf(buf, pVehicle->m_vehType); WriteSaveBuf(buf, pVehicle->GetModelIndex()); WriteSaveBuf(buf, GetVehicleRef(pVehicle)); memcpy(buf, pVehicle, sizeof(CBoat)); -- cgit v1.2.3