r2129 - in branches/nexuiz-2.0: . data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Wed Jan 17 13:43:23 EST 2007


Author: div0
Date: 2007-01-17 13:43:23 -0500 (Wed, 17 Jan 2007)
New Revision: 2129

Added:
   branches/nexuiz-2.0/nexuiz-dinput.bat
Modified:
   branches/nexuiz-2.0/data/qcsrc/server/g_world.qc
Log:
only shuffle ONCE; add nexuiz-dinput.bat


Modified: branches/nexuiz-2.0/data/qcsrc/server/g_world.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/g_world.qc	2007-01-17 18:42:58 UTC (rev 2128)
+++ branches/nexuiz-2.0/data/qcsrc/server/g_world.qc	2007-01-17 18:43:23 UTC (rev 2129)
@@ -1,5 +1,6 @@
 string GetMapname();
 void GotoNextMap();
+void HandleMaplistShuffleCommands();
 
 void SetDefaultAlpha()
 {
@@ -53,6 +54,7 @@
 	if(cvar("_sv_init"))
 	{
 		cvar_set("_sv_init", "0");
+		HandleMaplistShuffleCommands();
 		tokenize(cvar_string("g_maplist"));
 		if(argv(0) != GetMapname())
 		{
@@ -334,6 +336,9 @@
 	// 63 testing
 	lightstyle(63, "a");
 
+	registercvar("_g_maplist_shufflenow", "0");
+	registercvar("_g_maplist_have_shuffled", "0");
+
 	player_count = 0;
 	lms_lowest_lives = 0;
 	lms_next_place = 0;
@@ -1439,6 +1444,31 @@
 	cvar_set("g_maplist", result);
 }
 
+void() HandleMaplistShuffleCommands =
+{
+	// automatically shuffle when setting g_maplist_shuffle
+	if(cvar_string("_g_maplist_add") != "")
+	{
+		AddToMaplist(cvar_string("_g_maplist_add"));
+		cvar_set("_g_maplist_add", "");
+	}
+	if(cvar_string("_g_maplist_remove") != "")
+	{
+		RemoveFromMaplist(cvar_string("_g_maplist_remove"));
+		cvar_set("_g_maplist_remove", "");
+	}
+	if(cvar("_g_maplist_shufflenow") || (cvar("g_maplist_shuffle") && !cvar("_g_maplist_have_shuffled")))
+	{
+		ShuffleMaplist();
+		cvar_set("_g_maplist_shufflenow", "0");
+		cvar_set("_g_maplist_have_shuffled", "1");
+		ServerConsoleEcho("Shuffled map list.", FALSE);
+	}
+	if(cvar("_g_maplist_have_shuffled"))
+		if(!cvar("g_maplist_shuffle"))
+			cvar_set("_g_maplist_have_shuffled", "0");
+}
+
 /*
 ============
 CheckRules_World
@@ -1474,25 +1504,7 @@
 		PrintScoreboard();
 	}
 
-	// automatically shuffle when setting g_maplist_shuffle
-	if(cvar_string("_g_maplist_add") != "")
-	{
-		AddToMaplist(cvar_string("_g_maplist_add"));
-		cvar_set("_g_maplist_add", "");
-	}
-	if(cvar_string("_g_maplist_remove") != "")
-	{
-		RemoveFromMaplist(cvar_string("_g_maplist_remove"));
-		cvar_set("_g_maplist_remove", "");
-	}
-	if(cvar("_g_maplist_shufflenow") || (cvar("g_maplist_shuffle") && !cvar("_g_maplist_have_shuffled")))
-	{
-		ShuffleMaplist();
-		localcmd("set _g_maplist_shufflenow 0\nset _g_maplist_have_shuffled 1\necho Shuffled map list.\n");
-	}
-	if(cvar("_g_maplist_have_shuffled"))
-		if(!cvar("g_maplist_shuffle"))
-			localcmd("set _g_maplist_have_shuffled 0\n");
+	HandleMaplistShuffleCommands();
 
 	timelimit = cvar("timelimit") * 60;
 	fraglimit = cvar("fraglimit");

Added: branches/nexuiz-2.0/nexuiz-dinput.bat
===================================================================
--- branches/nexuiz-2.0/nexuiz-dinput.bat	                        (rev 0)
+++ branches/nexuiz-2.0/nexuiz-dinput.bat	2007-01-17 18:43:23 UTC (rev 2129)
@@ -0,0 +1,3 @@
+ at echo off
+
+nexuiz -dinput %1 %2 %3 %4 %5 %6 %7 %8 %9




More information about the nexuiz-commits mailing list