r1967 - trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sun Dec 3 05:21:36 EST 2006


Author: div0
Date: 2006-12-03 05:21:36 -0500 (Sun, 03 Dec 2006)
New Revision: 1967

Modified:
   trunk/data/qcsrc/server/g_world.qc
Log:
simplified GetMaplistPosition


Modified: trunk/data/qcsrc/server/g_world.qc
===================================================================
--- trunk/data/qcsrc/server/g_world.qc	2006-12-03 10:17:29 UTC (rev 1966)
+++ trunk/data/qcsrc/server/g_world.qc	2006-12-03 10:21:36 UTC (rev 1967)
@@ -427,29 +427,19 @@
 	return strcat("dm_", mapname);
 }
 
+float Map_Count, Map_Current;
+
+// NOTE: this now expects the map list to be already tokenize()d and the count in Map_Count
 float GetMaplistPosition()
 {
-	float pos, f;
-	string map, s;
+	float pos;
+	string map;
 
-	map = strzone(GetMapname());
-	pos = 0;
-	f = tokenize(cvar_string("g_maplist"));
-
-	while(pos < f)
-	{
-		s = strzone(argv(pos));
-		if(s == map)
-		{
-			strunzone(s);
-			strunzone(map);
+	map = GetMapname();
+	for(pos = 0; pos < Map_Count; ++pos)
+		if(map == argv(pos))
 			return pos;
-		}
-		strunzone(s);
-		pos++;
-	}
 
-	strunzone(map);
 	// resume normal maplist rotation if current map is not in g_maplist
 	return cvar("g_maplist_index");
 }
@@ -484,8 +474,6 @@
 	return TRUE;
 }
 
-float Map_Count, Map_Current;
-
 string Map_Filename(float position)
 {
 	return strcat("maps/", argv(position), ".mapcfg");




More information about the nexuiz-commits mailing list