Merge pull request #1257 from Nopey/fixbugs_pedgaplist
Fix bug triggering gnNumTempPedList assertion
This commit is contained in:
commit
1eedf7f0ae
@ -393,8 +393,20 @@ CPed::BuildPedLists(void)
|
||||
if (ped != this && !ped->bInVehicle) {
|
||||
float dist = (ped->GetPosition() - GetPosition()).Magnitude2D();
|
||||
if (nThreatReactionRangeMultiplier * 30.0f > dist) {
|
||||
#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));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user