diff options
Diffstat (limited to 'src/peds')
-rw-r--r-- | src/peds/Population.cpp | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp index d7a545d8..13ae95d2 100644 --- a/src/peds/Population.cpp +++ b/src/peds/Population.cpp @@ -1517,8 +1517,11 @@ CPopulation::PlaceGangMembersInCircle(ePedType pedType, int pedAmount, CVector c if (CPedPlacement::IsPositionClearForPed(coors, circleR, -1, 0)) { int pedIdx = 0; CVector leaderPos; +#ifdef FIX_BUGS + bool createLeader = true; +#endif - for (int i = 0; i < pedAmount; i++) { + for (int i = 0; i < pedAmount; i++) { float angleMult = i + CGeneral::GetRandomNumberInRange(-0.2f, 0.2f); float randomR = circleR + CGeneral::GetRandomNumberInRange(-0.2f, 0.2f) * circleR; float xOffset = randomR * Cos(angleMult * circleSector); @@ -1527,8 +1530,10 @@ CPopulation::PlaceGangMembersInCircle(ePedType pedType, int pedAmount, CVector c float groundZ = CWorld::FindGroundZFor3DCoord(xOffset + coors.x, yOffset + coors.y, coors.z + 1.0, &foundGround) + 1.0f; if (foundGround) { CVector finalPos(coors.x + xOffset, coors.y + yOffset, coors.z > groundZ ? coors.z : groundZ); - - if (i == 0) +#ifndef FIX_BUGS + const bool createLeader = i == 0; +#endif + if (createLeader) leaderPos = finalPos; int gangModel = ChooseGangOccupation(pedType - PEDTYPE_GANG1); @@ -1551,9 +1556,9 @@ CPopulation::PlaceGangMembersInCircle(ePedType pedType, int pedAmount, CVector c } } } - bool memberCanSeeLeader = i == 0 ? true : CWorld::GetIsLineOfSightClear(finalPos, leaderPos, true, false, false, false, false, false, false); + bool memberCanSeeLeader = createLeader ? true : CWorld::GetIsLineOfSightClear(finalPos, leaderPos, true, false, false, false, false, false, false); - bool notTooCloseToLeader = i == 0 ? true : !(Abs(finalPos.z - leaderPos.z) < 1.0f); + bool notTooCloseToLeader = createLeader ? true : !(Abs(finalPos.z - leaderPos.z) < 1.0f); if (!foundObstacle && memberCanSeeLeader && notTooCloseToLeader) { CPed* newPed = AddPed(pedType, gangModel, finalPos); @@ -1576,6 +1581,9 @@ CPopulation::PlaceGangMembersInCircle(ePedType pedType, int pedAmount, CVector c #endif } } +#ifdef FIX_BUGS + createLeader = false; +#endif } } if (pedIdx >= 3) { @@ -1700,6 +1708,9 @@ CPopulation::PlaceMallPedsAsStationaryGroup(CVector const& coors, int32 group) if (CPedPlacement::IsPositionClearForPed(coors, circleR, -1, 0)) { int pedIdx = 0; CVector leaderPos; +#ifdef FIX_BUGS + bool createLeader = true; +#endif for (int i = 0; i < pedAmount; i++) { float angleMult = i + CGeneral::GetRandomNumberInRange(-0.2f, 0.2f); @@ -1711,7 +1722,10 @@ CPopulation::PlaceMallPedsAsStationaryGroup(CVector const& coors, int32 group) if (foundGround) { CVector finalPos(coors.x + xOffset, coors.y + yOffset, coors.z > groundZ ? coors.z : groundZ); - if (i == 0) +#ifndef FIX_BUGS + const bool createLeader = i == 0; +#endif + if (createLeader) leaderPos = finalPos; int pedModel = ChooseCivilianOccupation(group); @@ -1735,9 +1749,9 @@ CPopulation::PlaceMallPedsAsStationaryGroup(CVector const& coors, int32 group) } } } - bool memberCanSeeLeader = i == 0 ? true : CWorld::GetIsLineOfSightClear(finalPos, leaderPos, true, false, false, false, false, false, false); + bool memberCanSeeLeader = createLeader ? true : CWorld::GetIsLineOfSightClear(finalPos, leaderPos, true, false, false, false, false, false, false); - bool notTooCloseToLeader = i == 0 ? true : !(Abs(finalPos.z - leaderPos.z) < 1.0f); + bool notTooCloseToLeader = createLeader ? true : !(Abs(finalPos.z - leaderPos.z) < 1.0f); if (!foundObstacle && memberCanSeeLeader && notTooCloseToLeader) { CPed *newPed = AddPed(pedModelInfo->m_pedType, pedModel, finalPos); @@ -1758,6 +1772,9 @@ CPopulation::PlaceMallPedsAsStationaryGroup(CVector const& coors, int32 group) #endif } } +#ifdef FIX_BUGS + createLeader = false; +#endif } } if (pedIdx >= 3) { |