diff options
author | Magnus Larsen <golgothasTerror101@gmail.com> | 2021-07-26 19:23:37 -0700 |
---|---|---|
committer | Sergeanur <s.anureev@yandex.ua> | 2021-07-31 20:34:32 +0300 |
commit | d923cd2f240d29a062c91a2b00c110f74986f281 (patch) | |
tree | f0e596609499ff30b70a90fee1d651ab65a90b01 /src/peds | |
parent | 835fa4e74b1014ca1ccef83979f039cafb75e3a4 (diff) |
Allow sector ped count to exceed gap-list size
This solves the gnNumTempPedList assertion.
To prove this works, change gapTempPedList's length to 12, and visit the
Triad's basketball court.
# Conflicts:
# src/peds/Ped.cpp
Diffstat (limited to 'src/peds')
-rw-r--r-- | src/peds/Ped.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index eadd9d64..7194d824 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -511,8 +511,20 @@ CPed::BuildPedLists(void) continue; deadsRegistered++; } +#ifdef FIX_BUGS + // If the gap ped list is full, sort it and truncate it + // before pushing more unsorted peds + if( gnNumTempPedList == ARRAY_SIZE(gapTempPedList) - 1 ) + { + gapTempPedList[gnNumTempPedList] = nil; + SortPeds(gapTempPedList, 0, gnNumTempPedList - 1); + gnNumTempPedList = ARRAY_SIZE(m_nearPeds); + } +#endif + gapTempPedList[gnNumTempPedList] = ped; gnNumTempPedList++; + // NOTE: We cannot absolutely fill the gap list, as the list is null-terminated before being passed to SortPeds assert(gnNumTempPedList < ARRAY_SIZE(gapTempPedList)); } } |