mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 23:01:50 +00:00
- Fixed: RandomSpawner could hang on lists with monsters when nomonsters is enabled or with 'None' items.
SVN r4155 (trunk)
This commit is contained in:
parent
071002c02b
commit
e0db52629d
1 changed files with 13 additions and 11 deletions
|
@ -59,22 +59,24 @@ class ARandomSpawner : public AActor
|
|||
// Take a random number...
|
||||
n = pr_randomspawn(n);
|
||||
// And iterate in the array up to the random number chosen.
|
||||
while (n > -1)
|
||||
while (n > -1 && di != NULL)
|
||||
{
|
||||
if (di->Name != NAME_None)
|
||||
if (di->Name != NAME_None &&
|
||||
(!nomonsters || !(GetDefaultByType(PClass::FindClass(di->Name))->flags3 & MF3_ISMONSTER)))
|
||||
{
|
||||
if (!nomonsters || !(GetDefaultByType(PClass::FindClass(di->Name))->flags3 & MF3_ISMONSTER))
|
||||
{
|
||||
n -= di->amount;
|
||||
if ((di->Next != NULL) && (n > -1))
|
||||
di = di->Next;
|
||||
else
|
||||
n = -1;
|
||||
}
|
||||
n -= di->amount;
|
||||
if ((di->Next != NULL) && (n > -1))
|
||||
di = di->Next;
|
||||
else
|
||||
n = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
di = di->Next;
|
||||
}
|
||||
}
|
||||
// So now we can spawn the dropped item.
|
||||
if (bouncecount >= MAX_RANDOMSPAWNERS_RECURSION) // Prevents infinite recursions
|
||||
if (di == NULL || bouncecount >= MAX_RANDOMSPAWNERS_RECURSION) // Prevents infinite recursions
|
||||
{
|
||||
Spawn("Unknown", x, y, z, NO_REPLACE); // Show that there's a problem.
|
||||
Destroy();
|
||||
|
|
Loading…
Reference in a new issue