shithub: choc

Download patch

ref: 66650c0a4b7dbb96b29e8ca717af0bdf4f2c4e8d
parent: 790a207f62517b4599dcec84c8af582782257c77
author: Simon Howard <[email protected]>
date: Sat Dec 16 18:12:40 EST 2006

Allow -warp 1 to warp to E1M1, -warp 2 -> E2M1, etc. when playing Doom
1. Thanks for RazTK for pointing this out.

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 783

--- a/src/d_main.c
+++ b/src/d_main.c
@@ -1617,14 +1617,22 @@
     p = M_CheckParm ("-warp");
     if (p && p < myargc-1)
     {
-	if (gamemode == commercial)
-	    startmap = atoi (myargv[p+1]);
-	else
-	{
-	    startepisode = myargv[p+1][0]-'0';
-	    startmap = myargv[p+2][0]-'0';
-	}
-	autostart = true;
+        if (gamemode == commercial)
+            startmap = atoi (myargv[p+1]);
+        else
+        {
+            startepisode = myargv[p+1][0]-'0';
+
+            if (p + 2 < myargc)
+            {
+                startmap = myargv[p+2][0]-'0';
+            }
+            else
+            {
+                startmap = 1;
+            }
+        }
+        autostart = true;
     }
 
     // Invoked by setup to test the controls.