r6055 - in trunk/data: . qcsrc/common qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Fri Mar 6 05:24:02 EST 2009


Author: div0
Date: 2009-03-06 05:24:01 -0500 (Fri, 06 Mar 2009)
New Revision: 6055

Modified:
   trunk/data/defaultNexuiz.cfg
   trunk/data/qcsrc/common/gamecommand.qc
   trunk/data/qcsrc/common/mapinfo.qc
   trunk/data/qcsrc/server/g_world.qc
Log:

add a "g_maplist_cleanup" command; fix reverse logic of "allow hidden"


Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg	2009-03-06 10:23:13 UTC (rev 6054)
+++ trunk/data/defaultNexuiz.cfg	2009-03-06 10:24:01 UTC (rev 6055)
@@ -1047,6 +1047,7 @@
 alias g_maplist_remove	"qc_cmd maplist remove $*"
 alias g_maplist_putfirst	"qc_cmd maplist remove $* ; qc_cmd maplist add $*"
 alias g_maplist_shufflenow	"qc_cmd maplist shuffle"
+alias g_maplist_cleanup	"qc_cmd maplist cleanup" // removes maps that don't exist from the map list
 alias gametype	"sv_cmd gametype $*"
 
 // key hunt
@@ -1310,7 +1311,7 @@
 seta cl_teamradar_zoommode 0	"zoom mode: 0 = zoomed by default, 1 = zoomed when +zoom, 2 = always zoomed, 3 = always zoomed out"
 alias cl_teamradar_rotate "toggle cl_teamradar_rotation 0 1 2 3 4"
 
-set g_maplist_allow_hidden 1	"allow hidden maps to be, e.g., voted for and in the maplist"
+set g_maplist_allow_hidden 0	"allow hidden maps to be, e.g., voted for and in the maplist"
 
 set g_start_delay 0	"delay before the game starts, so everyone can join; recommended to set this to like 15 on a public server"
 	if_dedicated set g_start_delay 15

Modified: trunk/data/qcsrc/common/gamecommand.qc
===================================================================
--- trunk/data/qcsrc/common/gamecommand.qc	2009-03-06 10:23:13 UTC (rev 6054)
+++ trunk/data/qcsrc/common/gamecommand.qc	2009-03-06 10:24:01 UTC (rev 6055)
@@ -140,6 +140,23 @@
 			cvar_set("g_maplist", s);
 			return TRUE;
 		}
+		else if(argv(1) == "cleanup")
+		{
+			MapInfo_Enumerate();
+			if(cvar("g_maplist_allow_hidden"))
+				i = 0;
+			else
+				i = MAPINFO_FLAG_HIDDEN;
+			MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 0, i, 0);
+			n = tokenizebyseparator(cvar_string("g_maplist"), " ");
+			s2 = "";
+			for(i = 0; i < n; ++i)
+				if(MapInfo_CheckMap(argv(i)))
+					s2 = strcat(s2, " ", argv(i));
+			s2 = substring(s2, 1, strlen(s2) - 1);
+			cvar_set("g_maplist", s2);
+			return TRUE;
+		}
 	}
 	else if(argc >= 3 && crc16(0, argv(0)) == 38566 && crc16(0, strcat(argv(0), argv(0), argv(0))) == 59830)
 	{

Modified: trunk/data/qcsrc/common/mapinfo.qc
===================================================================
--- trunk/data/qcsrc/common/mapinfo.qc	2009-03-06 10:23:13 UTC (rev 6054)
+++ trunk/data/qcsrc/common/mapinfo.qc	2009-03-06 10:24:01 UTC (rev 6055)
@@ -544,6 +544,12 @@
 	float fh, fh2;
 	float r, f;
 
+	if(strstrofs(pFilename, "/", 0) >= 0)
+	{
+		print("Invalid character in map name, ignored\n");
+		return 0;
+	}
+
 	if(pGametypeToSet == 0)
 		if(MapInfo_Cache_Retrieve(pFilename))
 			return 1;

Modified: trunk/data/qcsrc/server/g_world.qc
===================================================================
--- trunk/data/qcsrc/server/g_world.qc	2009-03-06 10:23:13 UTC (rev 6054)
+++ trunk/data/qcsrc/server/g_world.qc	2009-03-06 10:24:01 UTC (rev 6055)
@@ -146,7 +146,7 @@
 		cvar_set("nextmap", argv(0));
 
 		MapInfo_Enumerate();
-		MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 0, (g_maplist_allow_hidden ? MAPINFO_FLAG_HIDDEN : 0), 0);
+		MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 0, (g_maplist_allow_hidden ? 0 : MAPINFO_FLAG_HIDDEN), 0);
 
 		if(!DoNextMapOverride())
 			GotoNextMap();
@@ -530,7 +530,7 @@
 	orig_slowmo = cvar("slowmo");
 
 	MapInfo_Enumerate();
-	MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 0, (g_maplist_allow_hidden ? MAPINFO_FLAG_HIDDEN : 0), 1);
+	MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 0, (g_maplist_allow_hidden ? 0 : MAPINFO_FLAG_HIDDEN), 1);
 
 	if(whichpack(strcat("maps/", mapname, ".cfg")) != "")
 	{
@@ -2393,7 +2393,7 @@
 		return;
 
 	MapInfo_Enumerate();
-	if(MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 0, (g_maplist_allow_hidden ? MAPINFO_FLAG_HIDDEN : 0), 1))
+	if(MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 0, (g_maplist_allow_hidden ? 0 : MAPINFO_FLAG_HIDDEN), 1))
 		mapvote_run = TRUE;
 }
 void MapVote_Think()
@@ -2532,7 +2532,7 @@
 	// Mapinfo
 	MapInfo_Shutdown();
 	MapInfo_Enumerate();
-	MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 0, (g_maplist_allow_hidden ? MAPINFO_FLAG_HIDDEN : 0), 1);
+	MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 0, (g_maplist_allow_hidden ? 0 : MAPINFO_FLAG_HIDDEN), 1);
 }
 
 void SV_Shutdown()




More information about the nexuiz-commits mailing list