shithub: choc

Download patch

ref: 59d2ed0f2de6b2156142c87d48b0f55fa56b2acf
parent: b11030cbfee0d4d4a46673001992e94abc146c8c
author: Simon Howard <[email protected]>
date: Thu Dec 2 15:32:52 EST 2010

Add -servername parameter to allow the owner to change the name returned
in response to queries (thanks AlexMax).

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

--- a/src/net_server.c
+++ b/src/net_server.c
@@ -1079,6 +1079,7 @@
 {
     net_packet_t *reply;
     net_querydata_t querydata;
+    int p;
 
     // Version
 
@@ -1098,9 +1099,22 @@
     querydata.gamemode = sv_gamemode;
     querydata.gamemission = sv_gamemission;
 
-    // Server description.  This is currently hard-coded.
+    //!
+    // @arg <name>
+    //
+    // When starting a network server, specify a name for the server.
+    //
 
-    querydata.description = "Chocolate Doom server";
+    p = M_CheckParm("-servername");
+
+    if (p > 0 && p + 1 < myargc)
+    {
+        querydata.description = myargv[p + 1];
+    }
+    else
+    {
+        querydata.description = "Unnamed server";
+    }
 
     // Send it and we're done.