From ec10367856ed53152c50c57aea05fb4e468daa60 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 17 Dec 2017 20:57:45 +0000 Subject: [PATCH] Bail out of P_RespawnSpecials if no mobjinfo entry has a doomednum that matches, and print a warning to the console. This prevents a mobj of NUMMOBJTYPES from being created and potentially crashing the game. Really, this happens only if you start messing with the mapthings of respawning items like rings/weapons/etc in the first place via Lua. --- src/p_mobj.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/p_mobj.c b/src/p_mobj.c index 7871d10cd..5f85474c6 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -8332,6 +8332,16 @@ void P_RespawnSpecials(void) if (mthing->type == mobjinfo[i].doomednum) break; + if (i == NUMMOBJTYPES) // prevent creation of objects with this type -- Monster Iestyn 17/12/17 + { + // 3D Mode start Thing is unlikely to be added to the que, + // so don't bother checking for that specific type + CONS_Alert(CONS_WARNING, M_GetText("P_RespawnSpecials: Unknown thing type %d attempted to respawn at (%d, %d)\n"), mthing->type, mthing->x, mthing->y); + // pull it from the que + iquetail = (iquetail+1)&(ITEMQUESIZE-1); + return; + } + //CTF rings should continue to respawn as normal rings outside of CTF. if (gametype != GT_CTF) {