shithub: choc

Download patch

ref: 267d98c2325b2fbd78df25eff79ae6f048f48cfe
parent: 48d2fd26ca4c1de5112103788841751619ebfe9c
author: Simon Howard <[email protected]>
date: Sat Jun 3 08:38:24 EDT 2006

Bomb out with an error message if game options are specified to a 
dedicated server.

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

--- a/src/net_dedicated.c
+++ b/src/net_dedicated.c
@@ -30,12 +30,48 @@
 #include "i_system.h"
 #include "i_timer.h"
 
+#include "m_argv.h"
+
 #include "net_defs.h"
 #include "net_sdl.h"
 #include "net_server.h"
 
+// 
+// People can become confused about how dedicated servers work.  Game
+// options are specified to the controlling player who is the first to
+// join a game.  Bomb out with an error message if game options are
+// specified to a dedicated server.
+//
+
+static char *not_dedicated_options[] = 
+{
+    "-deh", "-iwad", "-cdrom", "-gameversion", "-nomonsters", "-respawn",
+    "-fast", "-altdeath", "-deathmatch", "-turbo", "-merge", "-af", "-as",
+    "-aa", "-file", "-wart", "-skill", "-episode", "-timer", "-avg", "-warp",
+    "-loadgame", "-longtics", "-extratics", "-dup", NULL,
+};
+
+static void CheckForClientOptions(void)
+{
+    int i;
+
+    for (i=0; not_dedicated_options[i] != NULL; ++i)
+    {
+        if (M_CheckParm(not_dedicated_options[i]) > 0)
+        {
+            I_Error("The command line parameter '%s' was specified to a "
+                    "dedicated server.\nGame parameters should be specified "
+                    "to the first player to join a server, \nnot to the "
+                    "server itself. ",
+                    not_dedicated_options[i]);
+        }
+    }
+}
+
 void NET_DedicatedServer(void)
 {
+    CheckForClientOptions();
+
     NET_SV_Init();
 
     NET_SV_AddModule(&net_sdl_module);