r2963 - in trunk/data/qcsrc: common server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Thu Nov 15 17:09:25 EST 2007


Author: div0
Date: 2007-11-15 17:09:25 -0500 (Thu, 15 Nov 2007)
New Revision: 2963

Modified:
   trunk/data/qcsrc/common/mapinfo.qc
   trunk/data/qcsrc/server/g_world.qc
Log:
some fixes against extreme CPU load and not loading the maplist


Modified: trunk/data/qcsrc/common/mapinfo.qc
===================================================================
--- trunk/data/qcsrc/common/mapinfo.qc	2007-11-15 21:44:10 UTC (rev 2962)
+++ trunk/data/qcsrc/common/mapinfo.qc	2007-11-15 22:09:25 UTC (rev 2963)
@@ -100,8 +100,6 @@
 }
 float MapInfo_FilterGametype(float pGametype, float pFeatures)
 {
-	MapInfo_Enumerate();
-
 	if(_MapInfo_filtered)
 		strunzone(_MapInfo_filtered);
 	_MapInfo_filtered = MapInfo_FilterGametype_Recursive(pGametype, pFeatures, 0, _MapInfo_globcount);
@@ -374,7 +372,7 @@
 		if(!(MapInfo_Map_supportedGametypes & pGametypeToSet))
 			error("Can't select the requested game type. Bailing out.");
 	if(MapInfo_Map_supportedGametypes != 0)
-		return 1;
+		return r;
 	dprint("Map ", pFilename, " supports no game types, ignored\n");
 	return 0;
 }
@@ -386,8 +384,6 @@
 	// note that DP sorts glob results... so I can use a binary search
 	string match;
 	float l, r, m, cmp;
-	MapInfo_Enumerate();
-	MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures());
 	l = 0;
 	r = MapInfo_count;
 	// invariants: r is behind s, l-1 is equal or before
@@ -484,8 +480,13 @@
 {
 	string out;
 	float i;
+
+	// to make absolutely sure:
 	MapInfo_Enumerate();
-	MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures());
+	for(;;)
+		if(MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures()))
+			break;
+
 	out = "";
 	for(i = 0; i < MapInfo_count; ++i)
 		out = strcat(out, " ", _MapInfo_GlobItem(HugeSetOfIntegers_get(_MapInfo_filtered, i)));

Modified: trunk/data/qcsrc/server/g_world.qc
===================================================================
--- trunk/data/qcsrc/server/g_world.qc	2007-11-15 21:44:10 UTC (rev 2962)
+++ trunk/data/qcsrc/server/g_world.qc	2007-11-15 22:09:25 UTC (rev 2963)
@@ -349,6 +349,11 @@
 	readlevelcvars();
 
 	Ban_LoadBans();
+
+#ifdef MAPINFO
+	MapInfo_Enumerate();
+	MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures());
+#endif
 }
 
 void light (void)
@@ -2069,7 +2074,14 @@
 }
 void MapVote_Start()
 {
-	mapvote_run = TRUE;
+	if(mapvote_run)
+		return;
+
+#ifdef MAPINFO
+	MapInfo_Enumerate();
+	if(MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures()))
+#endif
+		mapvote_run = TRUE;
 }
 void MapVote_Think()
 {




More information about the nexuiz-commits mailing list