r1978 - in branches/nexuiz-2.0: Docs/server data data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sun Dec 3 08:09:00 EST 2006


Author: div0
Date: 2006-12-03 08:09:00 -0500 (Sun, 03 Dec 2006)
New Revision: 1978

Modified:
   branches/nexuiz-2.0/Docs/server/server.cfg
   branches/nexuiz-2.0/data/default.cfg
   branches/nexuiz-2.0/data/qcsrc/server/g_world.qc
Log:
remove stupid requirement to manually call g_maplist_shufflenow


Modified: branches/nexuiz-2.0/Docs/server/server.cfg
===================================================================
--- branches/nexuiz-2.0/Docs/server/server.cfg	2006-12-03 13:07:55 UTC (rev 1977)
+++ branches/nexuiz-2.0/Docs/server/server.cfg	2006-12-03 13:09:00 UTC (rev 1978)
@@ -43,7 +43,6 @@
 
 set "sv_mapchange_delay" "5" // how long the pause between maps will be
 set "g_maplist_shuffle" "0" // if "1", the first map of g_maplist will always get chosen as next map and inserted at a random place in the list
-g_maplist_shufflenow // you probably want to call this command when you use the above option
 
 // remove the // from the beginning of one g_maplist line to play those maps only
 // arena mode (1on1 tourney)

Modified: branches/nexuiz-2.0/data/default.cfg
===================================================================
--- branches/nexuiz-2.0/data/default.cfg	2006-12-03 13:07:55 UTC (rev 1977)
+++ branches/nexuiz-2.0/data/default.cfg	2006-12-03 13:09:00 UTC (rev 1978)
@@ -200,7 +200,7 @@
 seta g_maplist_index 0 // this is used internally for saving position in maplist cycle
 seta g_maplist_selectrandom 0 // if 1, a random map will be chosen as next map; DEPRECATED in favor of g_maplist_shuffle
 seta g_maplist_shuffle 0 // new randomization method: like selectrandom, but avoid playing the same maps in short succession. This works by taking out the first element and inserting it into g_maplist with a bias to the end of the list.
-alias g_maplist_shufflenow "set _g_maplist_shufflenow 1" // call this in server.cfg when using g_maplist_shuffle
+alias g_maplist_shufflenow "set _g_maplist_shufflenow 1"
 // timeout for kill credit when your damage knocks someone into a death trap
 set g_maxpushtime 8.0
 

Modified: branches/nexuiz-2.0/data/qcsrc/server/g_world.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/g_world.qc	2006-12-03 13:07:55 UTC (rev 1977)
+++ branches/nexuiz-2.0/data/qcsrc/server/g_world.qc	2006-12-03 13:09:00 UTC (rev 1978)
@@ -1213,29 +1213,29 @@
 {
 	string result;
 	float start;
-	float items;
+	float litems;
 	float selected;
 	float i;
 
 	result = cvar_string("g_maplist");
-	items = tokenize(result);
+	litems = tokenize(result);
 
-	for(start = 0; start < items - 1; ++start)
+	for(start = 0; start < litems - 1; ++start)
 	{
 		result = "";
 
 		// select a random item
-		selected = ceil(random() * (items - start) + start) - 1;
+		selected = ceil(random() * (litems - start) + start) - 1;
 
 		// shift this item to the place start
 		for(i = 0; i < start; ++i)
 			result = strcat(result, "'", argv(i), "'");
 		result = strcat(result, "'", argv(selected), "'");
-		for(i = start; i < items; ++i)
+		for(i = start; i < litems; ++i)
 			if(i != selected)
 				result = strcat(result, "'", argv(i), "'");
 
-		items = tokenize(result);
+		litems = tokenize(result);
 
 		dprint(result, "\n");
 	}
@@ -1278,11 +1278,15 @@
 		PrintScoreboard();
 	}
 
-	if(cvar("_g_maplist_shufflenow"))
+	// automatically shuffle when setting g_maplist_shuffle
+	if(cvar("_g_maplist_shufflenow") || (cvar("g_maplist_shuffle") && !cvar("_g_maplist_have_shuffled")))
 	{
-		cvar_set("_g_maplist_shufflenow", "0");
 		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");
 
 	timelimit = cvar("timelimit") * 60;
 	fraglimit = cvar("fraglimit");




More information about the nexuiz-commits mailing list