summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorerorcun <erayorcunus@gmail.com>2020-02-03 22:31:26 +0100
committerGitHub <noreply@github.com>2020-02-03 22:31:26 +0100
commit9cb5c5001216fb033afdb83766a641fc4fd3ec69 (patch)
tree6bf42432d7d4d5985117f9d931fcb5ce73d5812a /src
parentMerge pull request #322 from erorcun/erorcun (diff)
parentfew little things (diff)
downloadre3-9cb5c5001216fb033afdb83766a641fc4fd3ec69.tar
re3-9cb5c5001216fb033afdb83766a641fc4fd3ec69.tar.gz
re3-9cb5c5001216fb033afdb83766a641fc4fd3ec69.tar.bz2
re3-9cb5c5001216fb033afdb83766a641fc4fd3ec69.tar.lz
re3-9cb5c5001216fb033afdb83766a641fc4fd3ec69.tar.xz
re3-9cb5c5001216fb033afdb83766a641fc4fd3ec69.tar.zst
re3-9cb5c5001216fb033afdb83766a641fc4fd3ec69.zip
Diffstat (limited to 'src')
-rw-r--r--src/peds/Ped.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index 922de3ce..543dae57 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -2120,18 +2120,16 @@ CPed::SortPeds(CPed **list, int min, int max)
int left = max;
int right;
for(right = min; right <= left; ){
- // Those 1.0s are my addition to make sure loop always run for first time.
- for (float rightDist = middleDist-1.0f; middleDist > rightDist; right++) {
+ float rightDist, leftDist;
+ do {
rightDiff = GetPosition() - list[right]->GetPosition();
rightDist = rightDiff.Magnitude();
- }
- right--;
+ } while (middleDist > rightDist && ++right);
- for (float leftDist = middleDist+1.0f; middleDist < leftDist; left--) {
+ do {
leftDiff = GetPosition() - list[left]->GetPosition();
leftDist = leftDiff.Magnitude();
- }
- left++;
+ } while (middleDist < leftDist && left--);
if (right <= left) {
CPed *ped = list[right];
@@ -13136,10 +13134,9 @@ CPed::ProcessObjective(void)
{
if (!m_carInObjective || bInVehicle) {
#ifdef VC_PED_PORTS
- if (bInVehicle && m_pMyVehicle != m_carInObjective)
- {
+ if (bInVehicle && m_pMyVehicle != m_carInObjective) {
SetExitCar(m_pMyVehicle, 0);
- }
+ } else
#endif
{
bObjectiveCompleted = true;