r1977 - in trunk: Docs/server data data/qcsrc/server misc

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sun Dec 3 08:07:55 EST 2006


Author: div0
Date: 2006-12-03 08:07:55 -0500 (Sun, 03 Dec 2006)
New Revision: 1977

Modified:
   trunk/Docs/server/server.cfg
   trunk/data/default.cfg
   trunk/data/qcsrc/server/g_world.qc
   trunk/misc/nexuiz-map-compiler
Log:
remove stupid requirement to manually call g_maplist_shufflenow


Modified: trunk/Docs/server/server.cfg
===================================================================
--- trunk/Docs/server/server.cfg	2006-12-03 12:58:19 UTC (rev 1976)
+++ trunk/Docs/server/server.cfg	2006-12-03 13:07:55 UTC (rev 1977)
@@ -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: trunk/data/default.cfg
===================================================================
--- trunk/data/default.cfg	2006-12-03 12:58:19 UTC (rev 1976)
+++ trunk/data/default.cfg	2006-12-03 13:07:55 UTC (rev 1977)
@@ -217,7 +217,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: trunk/data/qcsrc/server/g_world.qc
===================================================================
--- trunk/data/qcsrc/server/g_world.qc	2006-12-03 12:58:19 UTC (rev 1976)
+++ trunk/data/qcsrc/server/g_world.qc	2006-12-03 13:07:55 UTC (rev 1977)
@@ -1249,29 +1249,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");
 	}
@@ -1314,11 +1314,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");

Modified: trunk/misc/nexuiz-map-compiler
===================================================================
--- trunk/misc/nexuiz-map-compiler	2006-12-03 12:58:19 UTC (rev 1976)
+++ trunk/misc/nexuiz-map-compiler	2006-12-03 13:07:55 UTC (rev 1977)
@@ -100,7 +100,9 @@
 sub q3map2(@)
 {
 	my @args = @_;
-	return !system $Q3MAP2, '-game', 'quake3', '-fs_basepath', $NEXUIZDIR, '-fs_game', 'data', '-v', @_;
+	my @args = ($Q3MAP2, '-game', 'quake3', '-fs_basepath', $NEXUIZDIR, '-fs_game', 'data', '-v', @_);
+	print "\$ @args\n";
+	return !system @args;
 }
 
 (my $mapdir = getcwd()) =~ s!/[^/]*(?:$)!!;




More information about the nexuiz-commits mailing list