From a6738fd139a81f7acf7f831fa4d46b8ee440e9e1 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Fri, 30 Mar 2018 10:44:42 +0300 Subject: [PATCH] Fixed infinite loop with None class in random spawner actor NoneSpawner : RandomSpawner { DropItem "None" } https://forum.zdoom.org/viewtopic.php?t=60027 --- wadsrc/static/zscript/shared/randomspawner.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/wadsrc/static/zscript/shared/randomspawner.txt b/wadsrc/static/zscript/shared/randomspawner.txt index 9914670b4..24892aeec 100644 --- a/wadsrc/static/zscript/shared/randomspawner.txt +++ b/wadsrc/static/zscript/shared/randomspawner.txt @@ -44,16 +44,16 @@ class RandomSpawner : Actor { while (di != null) { - if (di.Name != 'None') + bool shouldSkip = (di.Name == 'None') || (nomonsters && IsMonster(di)); + + if (!shouldSkip) { - if (!nomonsters || !IsMonster(di)) - { - int amt = di.Amount; - if (amt < 0) amt = 1; // default value is -1, we need a positive value. - n += amt; // this is how we can weight the list. - } - di = di.Next; + int amt = di.Amount; + if (amt < 0) amt = 1; // default value is -1, we need a positive value. + n += amt; // this is how we can weight the list. } + + di = di.Next; } if (n == 0) { // Nothing left to spawn. They must have all been monsters, and monsters are disabled.