diff options
author | aap <aap@papnet.eu> | 2020-03-24 08:49:55 +0100 |
---|---|---|
committer | aap <aap@papnet.eu> | 2020-03-24 08:49:55 +0100 |
commit | 55b62e2134a69540d07e4403f5c79f63eb6afa19 (patch) | |
tree | a44499a6ad2037992222b4bdd664bf5cef691dc9 /src/peds | |
parent | Merge pull request #352 from Nick007J/master (diff) | |
download | re3-55b62e2134a69540d07e4403f5c79f63eb6afa19.tar re3-55b62e2134a69540d07e4403f5c79f63eb6afa19.tar.gz re3-55b62e2134a69540d07e4403f5c79f63eb6afa19.tar.bz2 re3-55b62e2134a69540d07e4403f5c79f63eb6afa19.tar.lz re3-55b62e2134a69540d07e4403f5c79f63eb6afa19.tar.xz re3-55b62e2134a69540d07e4403f5c79f63eb6afa19.tar.zst re3-55b62e2134a69540d07e4403f5c79f63eb6afa19.zip |
Diffstat (limited to 'src/peds')
-rw-r--r-- | src/peds/Ped.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index 7fc83be3..db6b7ee2 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -2213,15 +2213,18 @@ CPed::BuildPedLists(void) } } else { CVector centre = CEntity::GetBoundCentre(); - CRect rect( - CWorld::GetSectorX(centre.x - 20.0f), - CWorld::GetSectorY(centre.y - 20.0f), - CWorld::GetSectorX(centre.x + 20.0f), - CWorld::GetSectorY(centre.y + 20.0f)); + CRect rect(centre.x - 20.0f, + centre.y - 20.0f, + centre.x + 20.0f, + centre.y + 20.0f); + int xstart = CWorld::GetSectorIndexX(rect.left); + int ystart = CWorld::GetSectorIndexY(rect.top); + int xend = CWorld::GetSectorIndexX(rect.right); + int yend = CWorld::GetSectorIndexY(rect.bottom); gnNumTempPedList = 0; - for(int y = rect.top; y <= rect.bottom; y++) { - for(int x = rect.left; x <= rect.right; x++) { + for(int y = ystart; y <= yend; y++) { + for(int x = xstart; x <= xend; x++) { for (CPtrNode *pedPtrNode = CWorld::GetSector(x,y)->m_lists[ENTITYLIST_PEDS].first; pedPtrNode; pedPtrNode = pedPtrNode->next) { CPed *ped = (CPed*)pedPtrNode->item; if (ped != this && !ped->bInVehicle) { @@ -2229,6 +2232,7 @@ CPed::BuildPedLists(void) if (nThreatReactionRangeMultiplier * 30.0f > dist) { gapTempPedList[gnNumTempPedList] = ped; gnNumTempPedList++; + assert(gnNumTempPedList < ARRAYSIZE(gapTempPedList)); } } } |