diff options
author | aap <aap@papnet.eu> | 2020-12-21 12:34:29 +0100 |
---|---|---|
committer | aap <aap@papnet.eu> | 2020-12-21 12:34:29 +0100 |
commit | fb97335d9f66d1cce6fba106e7b0f4e9bc7e5662 (patch) | |
tree | ecf021ec4959c7c6d0aafdc15220c89b97aa97ac /src/peds/PedAttractor.cpp | |
parent | main.cpp mostly checked against ps2 now (diff) | |
download | re3-fb97335d9f66d1cce6fba106e7b0f4e9bc7e5662.tar re3-fb97335d9f66d1cce6fba106e7b0f4e9bc7e5662.tar.gz re3-fb97335d9f66d1cce6fba106e7b0f4e9bc7e5662.tar.bz2 re3-fb97335d9f66d1cce6fba106e7b0f4e9bc7e5662.tar.lz re3-fb97335d9f66d1cce6fba106e7b0f4e9bc7e5662.tar.xz re3-fb97335d9f66d1cce6fba106e7b0f4e9bc7e5662.tar.zst re3-fb97335d9f66d1cce6fba106e7b0f4e9bc7e5662.zip |
Diffstat (limited to '')
-rw-r--r-- | src/peds/PedAttractor.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/peds/PedAttractor.cpp b/src/peds/PedAttractor.cpp index 05e72ed3..eeb65398 100644 --- a/src/peds/PedAttractor.cpp +++ b/src/peds/PedAttractor.cpp @@ -4,6 +4,7 @@ #include "General.h" #include "Vehicle.h" #include "World.h" +#include "MemoryHeap.h" const int gcMaxSizeOfAtmQueue = 1; const int gcMaxSizeOfSeatQueue = 1; @@ -18,8 +19,18 @@ std::vector<CVector> CPedShelterAttractor::ms_displacements; CPedAttractorManager* GetPedAttractorManager() { - static CPedAttractorManager manager; - return &manager; +// mobile just has a static here: +/* + static CPedAttractorManager pedAttrMgr; + return &pedAttrMgr; +*/ + static CPedAttractorManager *pedAttrMgr; + if(pedAttrMgr == nil){ + PUSH_MEMID(MEMID_PED_ATTR); + pedAttrMgr = new CPedAttractorManager; + POP_MEMID(); + } + return pedAttrMgr; } CVehicleToEffect::CVehicleToEffect(CVehicle* pVehicle) : m_pVehicle(pVehicle) @@ -100,8 +111,10 @@ const C2dEffect* CPedAttractorManager::GetEffectForIceCreamVan(CVehicle* pVehicl return assoc->ChooseEffect(pos); } } + PUSH_MEMID(MEMID_PED_ATTR); CVehicleToEffect effect(pVehicle); vVehicleToEffect.push_back(effect); + POP_MEMID(); return effect.ChooseEffect(pos); } @@ -645,6 +658,7 @@ CPedAttractor* CPedAttractorManager::RegisterPed(CPed* pPed, C2dEffect* pEffect, pRegisteredAttractor->RegisterPed(pPed); return pRegisteredAttractor; } + PUSH_MEMID(MEMID_PED_ATTR); switch (pEffect->pedattr.type) { case ATTRACTOR_ATM: vecAttractors.push_back(new CPedAtmAttractor(pEffect, matrix, gcMaxSizeOfAtmQueue, 1.0f, 30000.0f, 3000.0f, 0.2f, 0.15f, 0.1f, 0.1f)); break; case ATTRACTOR_SEAT: vecAttractors.push_back(new CPedSeatAttractor(pEffect, matrix, gcMaxSizeOfSeatQueue, 1.0f, 30000.0f, 3000.0f, 0.125f, 0.1f, 0.1f, 0.1f)); break; @@ -653,6 +667,7 @@ CPedAttractor* CPedAttractorManager::RegisterPed(CPed* pPed, C2dEffect* pEffect, case ATTRACTOR_SHELTER: vecAttractors.push_back(new CPedShelterAttractor(pEffect, matrix, gcMaxSizeOfShelterQueue, 1.0f, 30000.0f, 3000.0f, 0.5f, 6.28f, 0.1f, 0.1f)); break; case ATTRACTOR_ICECREAM: vecAttractors.push_back(new CPedIceCreamAttractor(pEffect, matrix, gcMaxSizeOfIceCreamQueue, 1.0f, 30000.0f, 3000.0f, 0.2f, 0.3f, 0.1f, 0.1f)); break; } + POP_MEMID(); if (pRegisteredAttractor) pRegisteredAttractor->RegisterPed(pPed); return pRegisteredAttractor; |