shithub: choc

Download patch

ref: 3235eb707ac0cf2a1977d80a67c00b9cd97a5336
parent: e9b9fefcf6b8163de9062430118fd626e79fa2c2
parent: 3181ed3caeaaefc20806486078f71919bc770bc9
author: Jonathan Dowland <jon+github@alcopop.org>
date: Wed Dec 19 08:39:46 EST 2018

Merge pull request #1124 from mfrancis95/master

Heretic: Gracefully error out when player starts are missing (fix #1122)

--- a/src/heretic/doomdef.h
+++ b/src/heretic/doomdef.h
@@ -553,6 +553,7 @@
 extern mapthing_t *deathmatch_p;
 extern mapthing_t deathmatchstarts[10];
 extern mapthing_t playerstarts[MAXPLAYERS];
+extern boolean playerstartsingame[MAXPLAYERS];
 
 extern int mouseSensitivity;
 
--- a/src/heretic/p_mobj.c
+++ b/src/heretic/p_mobj.c
@@ -1052,6 +1052,7 @@
     {
         // save spots for respawning in network games
         playerstarts[mthing->type - 1] = *mthing;
+        playerstartsingame[mthing->type - 1] = true;
         if (!deathmatch)
         {
             P_SpawnPlayer(mthing);
--- a/src/heretic/p_setup.c
+++ b/src/heretic/p_setup.c
@@ -60,6 +60,7 @@
 
 mapthing_t deathmatchstarts[10], *deathmatch_p;
 mapthing_t playerstarts[MAXPLAYERS];
+boolean playerstartsingame[MAXPLAYERS];
 
 /*
 =================
@@ -277,6 +278,18 @@
         spawnthing.type = SHORT(mt->type);
         spawnthing.options = SHORT(mt->options);
         P_SpawnMapThing(&spawnthing);
+    }
+
+    if (!deathmatch)
+    {
+        for (i = 0; i < MAXPLAYERS; i++)
+        {
+            if (playeringame[i] && !playerstartsingame[i])
+            {
+                I_Error("P_LoadThings: Player %d start missing (vanilla crashes here)", i + 1);
+            }
+            playerstartsingame[i] = false;
+        }
     }
 
     W_ReleaseLumpNum(lump);