diff options
author | Sergeanur <s.anureev@yandex.ua> | 2021-05-18 07:12:47 +0200 |
---|---|---|
committer | Sergeanur <s.anureev@yandex.ua> | 2021-05-18 07:12:47 +0200 |
commit | 19dd95a1cb6ce7bf8cc65b4b8bfbb4fab241a7ab (patch) | |
tree | 3cc2f99dca4e911a1bcfa17860dd2e30a99d6754 /src | |
parent | Merge branch 'miami' into lcs (diff) | |
parent | Merge pull request 'Pool fixes + peds not forming circle fix' (#4) from erorcun/re3:miami into miami (diff) | |
download | re3-19dd95a1cb6ce7bf8cc65b4b8bfbb4fab241a7ab.tar re3-19dd95a1cb6ce7bf8cc65b4b8bfbb4fab241a7ab.tar.gz re3-19dd95a1cb6ce7bf8cc65b4b8bfbb4fab241a7ab.tar.bz2 re3-19dd95a1cb6ce7bf8cc65b4b8bfbb4fab241a7ab.tar.lz re3-19dd95a1cb6ce7bf8cc65b4b8bfbb4fab241a7ab.tar.xz re3-19dd95a1cb6ce7bf8cc65b4b8bfbb4fab241a7ab.tar.zst re3-19dd95a1cb6ce7bf8cc65b4b8bfbb4fab241a7ab.zip |
Diffstat (limited to '')
-rw-r--r-- | src/audio/AudioScriptObject.cpp | 8 | ||||
-rw-r--r-- | src/audio/AudioScriptObject.h | 8 | ||||
-rw-r--r-- | src/buildings/Building.cpp | 4 | ||||
-rw-r--r-- | src/buildings/Building.h | 4 | ||||
-rw-r--r-- | src/buildings/Treadable.cpp | 4 | ||||
-rw-r--r-- | src/buildings/Treadable.h | 4 | ||||
-rw-r--r-- | src/collision/ColModel.cpp | 4 | ||||
-rw-r--r-- | src/collision/ColModel.h | 4 | ||||
-rw-r--r-- | src/core/Streaming.cpp | 3 | ||||
-rw-r--r-- | src/core/Zones.cpp | 17 | ||||
-rw-r--r-- | src/entities/Dummy.cpp | 4 | ||||
-rw-r--r-- | src/entities/Dummy.h | 4 | ||||
-rw-r--r-- | src/objects/Object.cpp | 30 | ||||
-rw-r--r-- | src/objects/Object.h | 8 | ||||
-rw-r--r-- | src/objects/Stinger.cpp | 30 | ||||
-rw-r--r-- | src/peds/CopPed.cpp | 2 | ||||
-rw-r--r-- | src/peds/Ped.cpp | 8 | ||||
-rw-r--r-- | src/peds/Ped.h | 8 | ||||
-rw-r--r-- | src/peds/Population.cpp | 29 | ||||
-rw-r--r-- | src/rw/MemoryMgr.cpp | 8 | ||||
-rw-r--r-- | src/vehicles/Vehicle.cpp | 8 | ||||
-rw-r--r-- | src/vehicles/Vehicle.h | 8 |
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 2071369e..944f76d8 100644 --- a/src/collision/ColModel.cpp +++ b/src/collision/ColModel.cpp @@ -36,7 +36,7 @@ CColModel::~CColModel(void) //--LCS: no pool used, but maybe we better keep it? void* -CColModel::operator new(size_t) +CColModel::operator new(size_t) throw() { CColModel* node = CPools::GetColModelPool()->New(); assert(node); @@ -44,7 +44,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 64911db8..ce6dcd6d 100644 --- a/src/collision/ColModel.h +++ b/src/collision/ColModel.h @@ -35,8 +35,8 @@ 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); bool Write(base::cRelocatableChunkWriter &writer, bool allocSpace); diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp index 39443410..03b78392 100644 --- a/src/core/Streaming.cpp +++ b/src/core/Streaming.cpp @@ -1912,8 +1912,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 09f50a26..30253809 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 a8205ba9..a535732c 100644 --- a/src/objects/Object.h +++ b/src/objects/Object.h @@ -88,10 +88,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 f0510099..84153667 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 1ddb136d..7637a907 100644 --- a/src/peds/Ped.h +++ b/src/peds/Ped.h @@ -708,10 +708,10 @@ public: float m_radiusToGuard; float m_fMaxHealth; - 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 396e6fa2..b8984165 100644 --- a/src/peds/Population.cpp +++ b/src/peds/Population.cpp @@ -1404,7 +1404,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) { @@ -1484,7 +1484,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 @@ -1528,9 +1528,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; @@ -1543,6 +1543,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 @@ -1551,9 +1554,6 @@ CPopulation::PlaceGangMembersInCircle(ePedType pedType, int pedAmount, CVector c #endif } } -#ifdef FIX_BUGS - createLeader = false; -#endif } } if (pedIdx >= 3) { @@ -1593,7 +1593,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) { @@ -1675,7 +1675,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 @@ -1700,6 +1700,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); @@ -1721,9 +1722,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; @@ -1734,6 +1735,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 @@ -1742,9 +1746,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 a05a32a1..239fc641 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 db4c598a..d29c2dc0 100644 --- a/src/vehicles/Vehicle.h +++ b/src/vehicles/Vehicle.h @@ -281,10 +281,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); |