From 6239796b92d958d7988f0e0bdb724d90f2599dea Mon Sep 17 00:00:00 2001 From: argv-minus-one Date: Sun, 8 Jul 2018 17:04:19 -0700 Subject: [PATCH] Move RandomSpawner's recursion check into PostBeginPlay. Previously, a RandomSpawner with infinite recursion would hang the game, because the recursion check was happening before the recursion counter (bouncecount) was set. --- wadsrc/static/zscript/shared/randomspawner.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/wadsrc/static/zscript/shared/randomspawner.txt b/wadsrc/static/zscript/shared/randomspawner.txt index 24892aeec..28313bbb7 100644 --- a/wadsrc/static/zscript/shared/randomspawner.txt +++ b/wadsrc/static/zscript/shared/randomspawner.txt @@ -84,7 +84,7 @@ class RandomSpawner : Actor } } // So now we can spawn the dropped item. - if (di == null || bouncecount >= MAX_RANDOMSPAWNERS_RECURSION) // Prevents infinite recursions + if (di == null) { Spawn("Unknown", Pos, NO_REPLACE); // Show that there's a problem. Destroy(); @@ -131,6 +131,13 @@ class RandomSpawner : Actor Actor newmobj = null; bool boss = false; + if (bouncecount >= MAX_RANDOMSPAWNERS_RECURSION) // Prevents infinite recursions + { + Spawn("Unknown", Pos, NO_REPLACE); // Show that there's a problem. + Destroy(); + return; + } + if (Species == 'None') { Destroy();