summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorerorcun <erorcunerorcun@hotmail.com.tr>2021-03-06 17:28:59 +0100
committerSergeanur <s.anureev@yandex.ua>2021-06-24 20:34:28 +0200
commit618d689dff9a22d9385abf36f5e364b38273b7cf (patch)
tree9378d463e73933c90dcf90be93da7c9bac3dbeb1 /src
parentFix quiet police scanner on OpenAL (diff)
downloadre3-618d689dff9a22d9385abf36f5e364b38273b7cf.tar
re3-618d689dff9a22d9385abf36f5e364b38273b7cf.tar.gz
re3-618d689dff9a22d9385abf36f5e364b38273b7cf.tar.bz2
re3-618d689dff9a22d9385abf36f5e364b38273b7cf.tar.lz
re3-618d689dff9a22d9385abf36f5e364b38273b7cf.tar.xz
re3-618d689dff9a22d9385abf36f5e364b38273b7cf.tar.zst
re3-618d689dff9a22d9385abf36f5e364b38273b7cf.zip
Diffstat (limited to '')
-rw-r--r--src/audio/AudioScriptObject.cpp8
-rw-r--r--src/audio/AudioScriptObject.h8
-rw-r--r--src/buildings/Building.cpp4
-rw-r--r--src/buildings/Building.h4
-rw-r--r--src/buildings/Treadable.cpp4
-rw-r--r--src/buildings/Treadable.h4
-rw-r--r--src/collision/ColModel.cpp4
-rw-r--r--src/collision/ColModel.h4
-rw-r--r--src/core/Streaming.cpp3
-rw-r--r--src/core/Zones.cpp17
-rw-r--r--src/entities/Dummy.cpp4
-rw-r--r--src/entities/Dummy.h4
-rw-r--r--src/objects/Object.cpp30
-rw-r--r--src/objects/Object.h8
-rw-r--r--src/objects/Stinger.cpp30
-rw-r--r--src/peds/CopPed.cpp2
-rw-r--r--src/peds/Ped.cpp8
-rw-r--r--src/peds/Ped.h8
-rw-r--r--src/peds/Population.cpp29
-rw-r--r--src/rw/MemoryMgr.cpp8
-rw-r--r--src/vehicles/Vehicle.cpp8
-rw-r--r--src/vehicles/Vehicle.h8
22 files changed, 132 insertions, 75 deletions
diff --git a/src/audio/AudioScriptObject.cpp b/src/audio/AudioScriptObject.cpp
index 7dbc1ad0..48c78c88 100644
--- a/src/audio/AudioScriptObject.cpp
+++ b/src/audio/AudioScriptObject.cpp
@@ -23,25 +23,25 @@ cAudioScriptObject::Reset()
}
void *
-cAudioScriptObject::operator new(size_t sz)
+cAudioScriptObject::operator new(size_t sz) throw()
{
return CPools::GetAudioScriptObjectPool()->New();
}
void *
-cAudioScriptObject::operator new(size_t sz, int handle)
+cAudioScriptObject::operator new(size_t sz, int handle) throw()
{
return CPools::GetAudioScriptObjectPool()->New(handle);
}
void
-cAudioScriptObject::operator delete(void *p, size_t sz)
+cAudioScriptObject::operator delete(void *p, size_t sz) throw()
{
CPools::GetAudioScriptObjectPool()->Delete((cAudioScriptObject *)p);
}
void
-cAudioScriptObject::operator delete(void *p, int handle)
+cAudioScriptObject::operator delete(void *p, int handle) throw()
{
CPools::GetAudioScriptObjectPool()->Delete((cAudioScriptObject *)p);
}
diff --git a/src/audio/AudioScriptObject.h b/src/audio/AudioScriptObject.h
index 8110b2bb..b9a7e61b 100644
--- a/src/audio/AudioScriptObject.h
+++ b/src/audio/AudioScriptObject.h
@@ -12,10 +12,10 @@ public:
void Reset(); /// ok
- static void* operator new(size_t);
- static void* operator new(size_t, int);
- static void operator delete(void*, size_t);
- static void operator delete(void*, int);
+ static void* operator new(size_t) throw();
+ static void* operator new(size_t, int) throw();
+ static void operator delete(void*, size_t) throw();
+ static void operator delete(void*, int) throw();
static void LoadAllAudioScriptObjects(uint8 *buf, uint32 size);
static void SaveAllAudioScriptObjects(uint8 *buf, uint32 *size);
diff --git a/src/buildings/Building.cpp b/src/buildings/Building.cpp
index 8035cf25..92c787e5 100644
--- a/src/buildings/Building.cpp
+++ b/src/buildings/Building.cpp
@@ -4,8 +4,8 @@
#include "Streaming.h"
#include "Pools.h"
-void *CBuilding::operator new(size_t sz) { return CPools::GetBuildingPool()->New(); }
-void CBuilding::operator delete(void *p, size_t sz) { CPools::GetBuildingPool()->Delete((CBuilding*)p); }
+void *CBuilding::operator new(size_t sz) throw() { return CPools::GetBuildingPool()->New(); }
+void CBuilding::operator delete(void *p, size_t sz) throw() { CPools::GetBuildingPool()->Delete((CBuilding*)p); }
void
CBuilding::ReplaceWithNewModel(int32 id)
diff --git a/src/buildings/Building.h b/src/buildings/Building.h
index 2c2dfb1f..f8ddfa46 100644
--- a/src/buildings/Building.h
+++ b/src/buildings/Building.h
@@ -9,8 +9,8 @@ public:
m_type = ENTITY_TYPE_BUILDING;
bUsesCollision = true;
}
- static void *operator new(size_t);
- static void operator delete(void*, size_t);
+ static void *operator new(size_t) throw();
+ static void operator delete(void*, size_t) throw();
void ReplaceWithNewModel(int32 id);
diff --git a/src/buildings/Treadable.cpp b/src/buildings/Treadable.cpp
index 00abbe13..d84603a6 100644
--- a/src/buildings/Treadable.cpp
+++ b/src/buildings/Treadable.cpp
@@ -4,5 +4,5 @@
#include "Treadable.h"
#include "Pools.h"
-void *CTreadable::operator new(size_t sz) { return CPools::GetTreadablePool()->New(); }
-void CTreadable::operator delete(void *p, size_t sz) { CPools::GetTreadablePool()->Delete((CTreadable*)p); }
+void *CTreadable::operator new(size_t sz) throw() { return CPools::GetTreadablePool()->New(); }
+void CTreadable::operator delete(void *p, size_t sz) throw() { CPools::GetTreadablePool()->Delete((CTreadable*)p); }
diff --git a/src/buildings/Treadable.h b/src/buildings/Treadable.h
index c3ab755e..6a183c63 100644
--- a/src/buildings/Treadable.h
+++ b/src/buildings/Treadable.h
@@ -5,8 +5,8 @@
class CTreadable : public CBuilding
{
public:
- static void *operator new(size_t);
- static void operator delete(void*, size_t);
+ static void *operator new(size_t) throw();
+ static void operator delete(void*, size_t) throw();
bool GetIsATreadable(void) { return true; }
};
diff --git a/src/collision/ColModel.cpp b/src/collision/ColModel.cpp
index 49847dbd..2224a804 100644
--- a/src/collision/ColModel.cpp
+++ b/src/collision/ColModel.cpp
@@ -27,7 +27,7 @@ CColModel::~CColModel(void)
}
void*
-CColModel::operator new(size_t)
+CColModel::operator new(size_t) throw()
{
CColModel* node = CPools::GetColModelPool()->New();
assert(node);
@@ -35,7 +35,7 @@ CColModel::operator new(size_t)
}
void
-CColModel::operator delete(void *p, size_t)
+CColModel::operator delete(void *p, size_t) throw()
{
CPools::GetColModelPool()->Delete((CColModel*)p);
}
diff --git a/src/collision/ColModel.h b/src/collision/ColModel.h
index cd5ae651..64f05f76 100644
--- a/src/collision/ColModel.h
+++ b/src/collision/ColModel.h
@@ -33,7 +33,7 @@ struct CColModel
void SetLinkPtr(CLink<CColModel*>*);
void GetTrianglePoint(CVector &v, int i) const;
- void *operator new(size_t);
- void operator delete(void *p, size_t);
+ void *operator new(size_t) throw();
+ void operator delete(void *p, size_t) throw();
CColModel& operator=(const CColModel& other);
}; \ No newline at end of file
diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp
index ee286278..6d980e18 100644
--- a/src/core/Streaming.cpp
+++ b/src/core/Streaming.cpp
@@ -1873,8 +1873,7 @@ CStreaming::RemoveCurrentZonesModels(void)
if (ms_currentPedGrp != -1)
for (i = 0; i < NUMMODELSPERPEDGROUP; i++) {
ms_bIsPedFromPedGroupLoaded[i] = false;
- if (CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i] != -1 &&
- CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i] != MI_MALE01) {
+ if (CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i] != -1) {
SetModelIsDeletable(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i]);
SetModelTxdIsDeletable(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i]);
}
diff --git a/src/core/Zones.cpp b/src/core/Zones.cpp
index 85564f03..26d3efb0 100644
--- a/src/core/Zones.cpp
+++ b/src/core/Zones.cpp
@@ -452,6 +452,7 @@ CTheZones::GetZoneInfoForTimeOfDay(const CVector *pos, CZoneInfo *info)
assert(d >= 0.0f && d <= 1.0f);
n = 1.0f - d;
}
+#ifdef FIX_BUGS
info->carDensity = day->carDensity * d + night->carDensity * n;
for(i = 0; i < ARRAY_SIZE(info->carThreshold); i++)
info->carThreshold[i] = day->carThreshold[i] * d + night->carThreshold[i] * n;
@@ -465,6 +466,22 @@ CTheZones::GetZoneInfoForTimeOfDay(const CVector *pos, CZoneInfo *info)
info->copPedThreshold = day->copPedThreshold * d + night->copPedThreshold * n;
for(i = 0; i < ARRAY_SIZE(info->gangPedThreshold); i++)
info->gangPedThreshold[i] = day->gangPedThreshold[i] * d + night->gangPedThreshold[i] * n;
+#else
+ // This is a complete mess.
+ info->carDensity = day->carDensity * n + night->carDensity * d;
+ for(i = 0; i < ARRAY_SIZE(info->carThreshold); i++)
+ info->carThreshold[i] = night->carThreshold[i] * d + night->carThreshold[i] * n;
+ for(i = 0; i < ARRAY_SIZE(info->boatThreshold); i++)
+ info->boatThreshold[i] = night->boatThreshold[i] * d + night->boatThreshold[i] * n;
+ for(i = 0; i < ARRAY_SIZE(info->gangThreshold); i++)
+ info->gangThreshold[i] = night->gangThreshold[i] * d + night->gangThreshold[i] * n;
+
+ info->copThreshold = night->copThreshold * d + night->copThreshold * n;
+ info->pedDensity = night->pedDensity * d + night->pedDensity * n;
+ info->copPedThreshold = night->copPedThreshold * d + night->copPedThreshold * n;
+ for(i = 0; i < ARRAY_SIZE(info->gangPedThreshold); i++)
+ info->gangPedThreshold[i] = night->gangPedThreshold[i] * d + night->gangPedThreshold[i] * n;
+#endif
}
if(CClock::GetIsTimeInRange(5, 19))
info->pedGroup = day->pedGroup;
diff --git a/src/entities/Dummy.cpp b/src/entities/Dummy.cpp
index 9878b595..d62d2434 100644
--- a/src/entities/Dummy.cpp
+++ b/src/entities/Dummy.cpp
@@ -4,8 +4,8 @@
#include "World.h"
#include "Dummy.h"
-void *CDummy::operator new(size_t sz) { return CPools::GetDummyPool()->New(); }
-void CDummy::operator delete(void *p, size_t sz) { CPools::GetDummyPool()->Delete((CDummy*)p); }
+void *CDummy::operator new(size_t sz) throw() { return CPools::GetDummyPool()->New(); }
+void CDummy::operator delete(void *p, size_t sz) throw() { CPools::GetDummyPool()->Delete((CDummy*)p); }
void
CDummy::Add(void)
diff --git a/src/entities/Dummy.h b/src/entities/Dummy.h
index 84b1ce1a..9b73eefc 100644
--- a/src/entities/Dummy.h
+++ b/src/entities/Dummy.h
@@ -12,8 +12,8 @@ public:
void Add(void);
void Remove(void);
- static void *operator new(size_t);
- static void operator delete(void*, size_t);
+ static void *operator new(size_t) throw();
+ static void operator delete(void*, size_t) throw();
};
bool IsDummyPointerValid(CDummy* pDummy);
diff --git a/src/objects/Object.cpp b/src/objects/Object.cpp
index 0721725d..575c592c 100644
--- a/src/objects/Object.cpp
+++ b/src/objects/Object.cpp
@@ -25,10 +25,32 @@ int16 CObject::nNoTempObjects;
//int16 CObject::nBodyCastHealth = 1000;
float CObject::fDistToNearestTree;
-void *CObject::operator new(size_t sz) { return CPools::GetObjectPool()->New(); }
-void *CObject::operator new(size_t sz, int handle) { return CPools::GetObjectPool()->New(handle);};
-void CObject::operator delete(void *p, size_t sz) { CPools::GetObjectPool()->Delete((CObject*)p); }
-void CObject::operator delete(void *p, int handle) { CPools::GetObjectPool()->Delete((CObject*)p); }
+// Object pools tends to be full sometimes, let's free a temp. object in this case.
+#ifdef FIX_BUGS
+void *CObject::operator new(size_t sz) throw() {
+ CObject *obj = CPools::GetObjectPool()->New();
+ if (!obj) {
+ CObjectPool *objectPool = CPools::GetObjectPool();
+ for (int32 i = 0; i < objectPool->GetSize(); i++) {
+ CObject *existing = objectPool->GetSlot(i);
+ if (existing && existing->ObjectCreatedBy == TEMP_OBJECT) {
+ int32 handle = objectPool->GetIndex(existing);
+ CWorld::Remove(existing);
+ delete existing;
+ obj = objectPool->New(handle);
+ break;
+ }
+ }
+ }
+ return obj;
+}
+#else
+void *CObject::operator new(size_t sz) throw() { return CPools::GetObjectPool()->New(); }
+#endif
+void *CObject::operator new(size_t sz, int handle) throw() { return CPools::GetObjectPool()->New(handle); };
+
+void CObject::operator delete(void *p, size_t sz) throw() { CPools::GetObjectPool()->Delete((CObject*)p); }
+void CObject::operator delete(void *p, int handle) throw() { CPools::GetObjectPool()->Delete((CObject*)p); }
CObject::CObject(void)
{
diff --git a/src/objects/Object.h b/src/objects/Object.h
index e34043a8..f59379bf 100644
--- a/src/objects/Object.h
+++ b/src/objects/Object.h
@@ -87,10 +87,10 @@ public:
static int16 nNoTempObjects;
static float fDistToNearestTree;
- static void *operator new(size_t);
- static void *operator new(size_t, int);
- static void operator delete(void*, size_t);
- static void operator delete(void*, int);
+ static void *operator new(size_t) throw();
+ static void *operator new(size_t, int) throw();
+ static void operator delete(void*, size_t) throw();
+ static void operator delete(void*, int) throw();
CObject(void);
CObject(int32, bool);
diff --git a/src/objects/Stinger.cpp b/src/objects/Stinger.cpp
index 41040d4a..29efea10 100644
--- a/src/objects/Stinger.cpp
+++ b/src/objects/Stinger.cpp
@@ -46,7 +46,14 @@ CStinger::Init(CPed *pPed)
pOwner = pPed;
for (i = 0; i < NUM_STINGER_SEGMENTS; i++) {
- pSpikes[i] = new CStingerSegment;
+ pSpikes[i] = new CStingerSegment();
+#ifdef FIX_BUGS
+ if (!pSpikes[i]) {
+ // Abort!! Pool is full
+ Remove();
+ return;
+ }
+#endif
pSpikes[i]->bUsesCollision = false;
}
bIsDeployed = true;
@@ -77,8 +84,11 @@ CStinger::Remove()
CStingerSegment *spikeSegment = pSpikes[i];
#ifdef FIX_BUGS
- CWorld::Remove(spikeSegment);
- delete spikeSegment;
+ if (spikeSegment) {
+ CWorld::Remove(spikeSegment);
+ delete spikeSegment;
+ pSpikes[i] = nil;
+ }
#else
if (spikeSegment->m_entryInfoList.first != nil)
spikeSegment->bRemoveFromWorld = true;
@@ -92,9 +102,15 @@ CStinger::Remove()
void
CStinger::Deploy(CPed *pPed)
{
+ // So total number of stingers allowed at the same time is 2, each by different CCopPed.
if (NumOfStingerSegments < NUM_STINGER_SEGMENTS*2 && !pPed->bInVehicle && pPed->IsPedInControl()) {
if (!bIsDeployed && RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_STD_THROW_UNDER) == nil) {
Init(pPed);
+#ifdef FIX_BUGS
+ // Above call won't set it to true no more when object pool is full
+ if (!bIsDeployed)
+ return;
+#endif
pPed->SetPedState(PED_DEPLOY_STINGER);
CAnimManager::AddAnimation(pPed->GetClump(), ASSOCGRP_STD, ANIM_STD_THROW_UNDER);
}
@@ -167,6 +183,7 @@ CStinger::CheckForBurstTyres()
}
}
+// Only called when bIsDeployed
void
CStinger::Process()
{
@@ -232,10 +249,11 @@ CStinger::Process()
break;
case STINGERSTATE_REMOVE:
Remove();
- break;
- }
#ifdef FIX_BUGS
- if (bIsDeployed)
+ return;
+#else
+ break;
#endif
+ }
CheckForBurstTyres();
} \ No newline at end of file
diff --git a/src/peds/CopPed.cpp b/src/peds/CopPed.cpp
index f2f3ee27..1efd7733 100644
--- a/src/peds/CopPed.cpp
+++ b/src/peds/CopPed.cpp
@@ -93,7 +93,7 @@ CCopPed::CCopPed(eCopType copType, int32 modifier) : CPed(PEDTYPE_COP)
m_nHassleTimer = 0;
field_61C = 0;
field_624 = 0;
- m_pStinger = new CStinger;
+ m_pStinger = new CStinger();
SetWeaponLockOnTarget(nil);
}
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index fe105645..d8c445bf 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -53,10 +53,10 @@ bool CPed::bFannyMagnetCheat;
bool CPed::bPedCheat3;
CVector2D CPed::ms_vec2DFleePosition;
-void *CPed::operator new(size_t sz) { return CPools::GetPedPool()->New(); }
-void *CPed::operator new(size_t sz, int handle) { return CPools::GetPedPool()->New(handle); }
-void CPed::operator delete(void *p, size_t sz) { CPools::GetPedPool()->Delete((CPed*)p); }
-void CPed::operator delete(void *p, int handle) { CPools::GetPedPool()->Delete((CPed*)p); }
+void *CPed::operator new(size_t sz) throw() { return CPools::GetPedPool()->New(); }
+void *CPed::operator new(size_t sz, int handle) throw() { return CPools::GetPedPool()->New(handle); }
+void CPed::operator delete(void *p, size_t sz) throw() { CPools::GetPedPool()->Delete((CPed*)p); }
+void CPed::operator delete(void *p, int handle) throw() { CPools::GetPedPool()->Delete((CPed*)p); }
float gfTommyFatness = 1.0f;
diff --git a/src/peds/Ped.h b/src/peds/Ped.h
index c94cd320..c5c6cf49 100644
--- a/src/peds/Ped.h
+++ b/src/peds/Ped.h
@@ -650,10 +650,10 @@ public:
CVector m_vecSpotToGuard;
float m_radiusToGuard;
- static void *operator new(size_t);
- static void *operator new(size_t, int);
- static void operator delete(void*, size_t);
- static void operator delete(void*, int);
+ static void *operator new(size_t) throw();
+ static void *operator new(size_t, int) throw();
+ static void operator delete(void*, size_t) throw();
+ static void operator delete(void*, int) throw();
CPed(uint32 pedType);
~CPed(void);
diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp
index 13ae95d2..3d4746d2 100644
--- a/src/peds/Population.cpp
+++ b/src/peds/Population.cpp
@@ -1434,7 +1434,7 @@ CPopulation::PlaceGangMembersInFormation(ePedType pedType, int pedAmount, CVecto
CPed *createdPeds[5];
if (!TheCamera.IsSphereVisible(coors, 3.0f) || MIN_CREATION_DIST * PedCreationDistMultiplier() <= (coors - FindPlayerPed()->GetPosition()).Magnitude2D()) {
- if (CPedPlacement::IsPositionClearForPed(coors, 3.0f, -1, 0)) {
+ if (CPedPlacement::IsPositionClearForPed(coors, 3.0f, -1, nil)) {
bool leaderFoundGround;
float leaderGroundZ = CWorld::FindGroundZFor3DCoord(coors.x, coors.y, coors.z, &leaderFoundGround) + 1.0f;
if (leaderFoundGround) {
@@ -1514,7 +1514,7 @@ CPopulation::PlaceGangMembersInCircle(ePedType pedType, int pedAmount, CVector c
if (!TheCamera.IsSphereVisible(coors, circleR) ||
MIN_CREATION_DIST * PedCreationDistMultiplier() <= (coors - FindPlayerPed()->GetPosition()).Magnitude2D()) {
- if (CPedPlacement::IsPositionClearForPed(coors, circleR, -1, 0)) {
+ if (CPedPlacement::IsPositionClearForPed(coors, circleR, -1, nil)) {
int pedIdx = 0;
CVector leaderPos;
#ifdef FIX_BUGS
@@ -1558,9 +1558,9 @@ CPopulation::PlaceGangMembersInCircle(ePedType pedType, int pedAmount, CVector c
}
bool memberCanSeeLeader = createLeader ? true : CWorld::GetIsLineOfSightClear(finalPos, leaderPos, true, false, false, false, false, false, false);
- bool notTooCloseToLeader = createLeader ? true : !(Abs(finalPos.z - leaderPos.z) < 1.0f);
+ bool notTooHighFromLeader = createLeader ? true : !(Abs(finalPos.z - leaderPos.z) >= 1.0f);
- if (!foundObstacle && memberCanSeeLeader && notTooCloseToLeader) {
+ if (!foundObstacle && memberCanSeeLeader && notTooHighFromLeader) {
CPed* newPed = AddPed(pedType, gangModel, finalPos);
if (newPed) {
createdPeds[pedIdx++] = newPed;
@@ -1573,6 +1573,9 @@ CPopulation::PlaceGangMembersInCircle(ePedType pedType, int pedAmount, CVector c
newPed->bCanAttackPlayerWithCops = true;
CVisibilityPlugins::SetClumpAlpha(newPed->GetClump(), 0);
+#ifdef FIX_BUGS
+ createLeader = false;
+#endif
}
// No.
#ifndef FIX_BUGS
@@ -1581,9 +1584,6 @@ CPopulation::PlaceGangMembersInCircle(ePedType pedType, int pedAmount, CVector c
#endif
}
}
-#ifdef FIX_BUGS
- createLeader = false;
-#endif
}
}
if (pedIdx >= 3) {
@@ -1623,7 +1623,7 @@ CPopulation::PlaceCouple(ePedType manType, int32 manModel, ePedType womanType, i
return;
if (!TheCamera.IsSphereVisible(coors, 1.5f) || MIN_CREATION_DIST * PedCreationDistMultiplier() <= (coors - FindPlayerPed()->GetPosition()).Magnitude2D()) {
- if (CPedPlacement::IsPositionClearForPed(coors, CModelInfo::GetModelInfo(manModel)->GetColModel()->boundingSphere.radius, -1, 0)) {
+ if (CPedPlacement::IsPositionClearForPed(coors, CModelInfo::GetModelInfo(manModel)->GetColModel()->boundingSphere.radius, -1, nil)) {
bool manFoundGround;
float manGroundZ = CWorld::FindGroundZFor3DCoord(coors.x, coors.y, coors.z, &manFoundGround) + 1.0f;
if (manFoundGround) {
@@ -1705,7 +1705,7 @@ CPopulation::PlaceMallPedsAsStationaryGroup(CVector const& coors, int32 group)
if (!TheCamera.IsSphereVisible(coors, circleR) ||
MIN_CREATION_DIST * PedCreationDistMultiplier() <= (coors - FindPlayerPed()->GetPosition()).Magnitude2D()) {
- if (CPedPlacement::IsPositionClearForPed(coors, circleR, -1, 0)) {
+ if (CPedPlacement::IsPositionClearForPed(coors, circleR, -1, nil)) {
int pedIdx = 0;
CVector leaderPos;
#ifdef FIX_BUGS
@@ -1730,6 +1730,7 @@ CPopulation::PlaceMallPedsAsStationaryGroup(CVector const& coors, int32 group)
int pedModel = ChooseCivilianOccupation(group);
CPedModelInfo *pedModelInfo = (CPedModelInfo*)CModelInfo::GetModelInfo(pedModel);
+
if (pedModelInfo->GetRwObject()) {
CEntity* obstacles[6] = { nil, nil, nil, nil, nil, nil };
CPedPlacement::IsPositionClearForPed(finalPos, CModelInfo::GetModelInfo(pedModel)->GetColModel()->boundingSphere.radius, ARRAY_SIZE(obstacles), obstacles);
@@ -1751,9 +1752,9 @@ CPopulation::PlaceMallPedsAsStationaryGroup(CVector const& coors, int32 group)
}
bool memberCanSeeLeader = createLeader ? true : CWorld::GetIsLineOfSightClear(finalPos, leaderPos, true, false, false, false, false, false, false);
- bool notTooCloseToLeader = createLeader ? true : !(Abs(finalPos.z - leaderPos.z) < 1.0f);
+ bool notTooHighFromLeader = createLeader ? true : !(Abs(finalPos.z - leaderPos.z) >= 1.0f);
- if (!foundObstacle && memberCanSeeLeader && notTooCloseToLeader) {
+ if (!foundObstacle && memberCanSeeLeader && notTooHighFromLeader) {
CPed *newPed = AddPed(pedModelInfo->m_pedType, pedModel, finalPos);
if (newPed) {
createdPeds[pedIdx++] = newPed;
@@ -1764,6 +1765,9 @@ CPopulation::PlaceMallPedsAsStationaryGroup(CVector const& coors, int32 group)
newPed->m_fRotationCur = angle;
newPed->m_fearFlags = 0;
CVisibilityPlugins::SetClumpAlpha(newPed->GetClump(), 0);
+#ifdef FIX_BUGS
+ createLeader = false;
+#endif
}
// No.
#ifndef FIX_BUGS
@@ -1772,9 +1776,6 @@ CPopulation::PlaceMallPedsAsStationaryGroup(CVector const& coors, int32 group)
#endif
}
}
-#ifdef FIX_BUGS
- createLeader = false;
-#endif
}
}
if (pedIdx >= 3) {
diff --git a/src/rw/MemoryMgr.cpp b/src/rw/MemoryMgr.cpp
index 2379692c..b9cff043 100644
--- a/src/rw/MemoryMgr.cpp
+++ b/src/rw/MemoryMgr.cpp
@@ -28,10 +28,10 @@ RwMemoryFunctions memFuncs = {
#ifdef USE_CUSTOM_ALLOCATOR
// game seems to be using heap directly here, but this is nicer
-void *operator new(size_t sz) { return MemoryMgrMalloc(sz); }
-void *operator new[](size_t sz) { return MemoryMgrMalloc(sz); }
-void operator delete(void *ptr) noexcept { MemoryMgrFree(ptr); }
-void operator delete[](void *ptr) noexcept { MemoryMgrFree(ptr); }
+void *operator new(size_t sz) throw() { return MemoryMgrMalloc(sz); }
+void *operator new[](size_t sz) throw() { return MemoryMgrMalloc(sz); }
+void operator delete(void *ptr) throw() { MemoryMgrFree(ptr); }
+void operator delete[](void *ptr) throw() { MemoryMgrFree(ptr); }
#endif
void*
diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp
index 4e6c24ef..9d90c616 100644
--- a/src/vehicles/Vehicle.cpp
+++ b/src/vehicles/Vehicle.cpp
@@ -50,10 +50,10 @@ bool CVehicle::bDisableRemoteDetonationOnContact;
bool CVehicle::m_bDisplayHandlingInfo;
#endif
-void *CVehicle::operator new(size_t sz) { return CPools::GetVehiclePool()->New(); }
-void *CVehicle::operator new(size_t sz, int handle) { return CPools::GetVehiclePool()->New(handle); }
-void CVehicle::operator delete(void *p, size_t sz) { CPools::GetVehiclePool()->Delete((CVehicle*)p); }
-void CVehicle::operator delete(void *p, int handle) { CPools::GetVehiclePool()->Delete((CVehicle*)p); }
+void *CVehicle::operator new(size_t sz) throw() { return CPools::GetVehiclePool()->New(); }
+void *CVehicle::operator new(size_t sz, int handle) throw() { return CPools::GetVehiclePool()->New(handle); }
+void CVehicle::operator delete(void *p, size_t sz) throw() { CPools::GetVehiclePool()->Delete((CVehicle*)p); }
+void CVehicle::operator delete(void *p, int handle) throw() { CPools::GetVehiclePool()->Delete((CVehicle*)p); }
#ifdef FIX_BUGS
// I think they meant that
diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h
index 2fb2caf4..37b57944 100644
--- a/src/vehicles/Vehicle.h
+++ b/src/vehicles/Vehicle.h
@@ -278,10 +278,10 @@ public:
float m_fSteerInput;
uint8 m_vehType;
- static void *operator new(size_t);
- static void *operator new(size_t sz, int slot);
- static void operator delete(void*, size_t);
- static void operator delete(void*, int);
+ static void *operator new(size_t) throw();
+ static void *operator new(size_t sz, int slot) throw();
+ static void operator delete(void*, size_t) throw();
+ static void operator delete(void*, int) throw();
CVehicle(void) {} // FAKE
CVehicle(uint8 CreatedBy);