r2610 - in trunk/data: . qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat May 19 13:40:26 EDT 2007


Author: div0
Date: 2007-05-19 13:40:25 -0400 (Sat, 19 May 2007)
New Revision: 2610

Modified:
   trunk/data/default.cfg
   trunk/data/qcsrc/server/clientcommands.qc
   trunk/data/qcsrc/server/g_world.qc
Log:
only allow game type changes by suggestions if g_maplist_votable_suggestions_change_gametype; only allow game type changes by chmap votes if sv_vote_change_gametype


Modified: trunk/data/default.cfg
===================================================================
--- trunk/data/default.cfg	2007-05-19 17:18:05 UTC (rev 2609)
+++ trunk/data/default.cfg	2007-05-19 17:40:25 UTC (rev 2610)
@@ -568,6 +568,8 @@
 set sv_vote_wait 120
 // a simple majority suffices to accept a vote (meaning: YES votes > NO votes, otherwise: YES votes > half of the players)
 set sv_vote_simple_majority 0
+// when disabled, don't allow game type changes
+set sv_vote_change_gametype 1
 alias vhelp "cmd vote help"
 alias vstatus "cmd vote status"
 alias vcall "cmd vote call $*"
@@ -678,6 +680,7 @@
 set g_maplist_votable_keeptwotime 15
 set g_maplist_votable_timeout 30 // note: must be below 50 seconds!
 set g_maplist_votable_suggestions 2
+set g_maplist_votable_suggestions_change_gametype 1
 alias suggestmap "cmd suggestmap $1"
 
 set g_chat_flood_spl 0                   // seconds between lines to not count as flooding

Modified: trunk/data/qcsrc/server/clientcommands.qc
===================================================================
--- trunk/data/qcsrc/server/clientcommands.qc	2007-05-19 17:18:05 UTC (rev 2609)
+++ trunk/data/qcsrc/server/clientcommands.qc	2007-05-19 17:40:25 UTC (rev 2610)
@@ -435,11 +435,19 @@
 	else
 		return TRUE;
 
+	if(!cvar("sv_vote_change_gametype"))
+		if(!IsSameGametype(argv(1)))
+		{
+			sprint(self, "This server does not allow changing the game type by map votes.\n");
+			return FALSE;
+		}
+
 	if(!TryFile(strcat("maps/", argv(1), ext)))
 	{
 		sprint(self, strcat("^1Invalid mapname, \"^3", argv(1), "^1\" does not exist on this server.\n"));
 		return FALSE;
 	}
+
 	return TRUE;
 }
 

Modified: trunk/data/qcsrc/server/g_world.qc
===================================================================
--- trunk/data/qcsrc/server/g_world.qc	2007-05-19 17:18:05 UTC (rev 2609)
+++ trunk/data/qcsrc/server/g_world.qc	2007-05-19 17:40:25 UTC (rev 2610)
@@ -383,6 +383,15 @@
 	return "dm";
 }
 
+float IsSameGametype(string mapcfgname)
+{
+	string gt;
+	gt = GetGametype();
+	if(substring(mapcfgname, 0, strlen(gt) + 1) == strcat(gt, "_"))
+		return TRUE;
+	return FALSE;
+}
+
 string getmapname_stored;
 string GetMapname()
 {
@@ -1566,6 +1575,12 @@
 		return "Suggestions are not accepted on this server.";
 	if(mapvote_initialized)
 		return "Can't suggest - voting is already in progress!";
+	if(!cvar("g_maplist_votable_suggestions_change_gametype"))
+		if(!IsSameGametype(m))
+		{
+			return "This server does not allow changing the game type by map suggestions.";
+		}
+
 	if(!TryFile(strcat("maps/", m, ".mapcfg")))
 		return "The map you suggested is not available on this server.";
 	for(i = 0; i < mapvote_suggestion_ptr; ++i)




More information about the nexuiz-commits mailing list