r2808 - in trunk/data: . qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Wed Sep 12 16:06:54 EDT 2007


Author: div0
Date: 2007-09-12 16:06:54 -0400 (Wed, 12 Sep 2007)
New Revision: 2808

Modified:
   trunk/data/default.cfg
   trunk/data/qcsrc/server/g_world.qc
   trunk/data/qcsrc/server/gamecommand.qc
Log:
fix "gotomap" command in case a map vote screen is running, or in case a previous chmap failed (so a server that hangs because of a broken mapcfg can be "reanimated" by a vcall chmap)


Modified: trunk/data/default.cfg
===================================================================
--- trunk/data/default.cfg	2007-09-12 19:57:11 UTC (rev 2807)
+++ trunk/data/default.cfg	2007-09-12 20:06:54 UTC (rev 2808)
@@ -34,7 +34,7 @@
 alias bsp "ls maps/*.bsp"
 alias mapcfg "ls maps/*.mapcfg"
 alias chmap "exec $exit_cfg ; exec game_reset.cfg; exec maps/$1.mapcfg"
-alias gotomap "nextmap $1; timelimit -1"
+alias gotomap "sv_cmd gotomap \"$1\""
 alias reset "exec game_reset.cfg"
 
 alias dem "ls demos/*.dem"

Modified: trunk/data/qcsrc/server/g_world.qc
===================================================================
--- trunk/data/qcsrc/server/g_world.qc	2007-09-12 19:57:11 UTC (rev 2807)
+++ trunk/data/qcsrc/server/g_world.qc	2007-09-12 20:06:54 UTC (rev 2808)
@@ -1959,6 +1959,22 @@
 	MapVote_Tick();
 };
 
+string GotoMap(string m)
+{
+	if(!TryFile(strcat("maps/", m, ".mapcfg")))
+		return "The map you chose is not available on this server.";
+	cvar_set("nextmap", m);
+	cvar_set("timelimit", "-1");
+	if(mapvote_initialized || alreadychangedlevel)
+	{
+		if(DoNextMapOverride())
+			return "Map switch initiated.";
+		else
+			return "Hm... no. For some reason I like THIS map more.";
+	}
+	else
+		return "Map switch will happen after scoreboard.";
+}
 
 
 void EndFrame()

Modified: trunk/data/qcsrc/server/gamecommand.qc
===================================================================
--- trunk/data/qcsrc/server/gamecommand.qc	2007-09-12 19:57:11 UTC (rev 2807)
+++ trunk/data/qcsrc/server/gamecommand.qc	2007-09-12 20:06:54 UTC (rev 2808)
@@ -1,3 +1,5 @@
+string GotoMap(string m);
+
 void GameCommand(string command)
 {
 	float argc;
@@ -38,6 +40,12 @@
 		return;
 	}
 
+	if(argv(0) == "gotomap") if(argc == 2)
+	{
+		print(GotoMap(argv(1)), "\n");
+		return;
+	}
+
 	if(argv(0) == "adminmsg") if(argc == 3)
 	{
 		entity client;




More information about the nexuiz-commits mailing list