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
This commit is contained in:
Magnus Larsen 2021-07-26 19:23:37 -07:00 committed by Sergeanur
parent 835fa4e74b
commit d923cd2f24
1 changed files with 12 additions and 0 deletions

View File

@ -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));
}
}