r4778 - in trunk/data: . qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat Oct 18 13:05:32 EDT 2008


Author: div0
Date: 2008-10-18 13:05:32 -0400 (Sat, 18 Oct 2008)
New Revision: 4778

Modified:
   trunk/data/defaultNexuiz.cfg
   trunk/data/qcsrc/server/vote.qc
Log:
-sv_vote_simple_majority
+sv_vote_simple_majority_factor

Allows to win a vote by either 2/3 majority of the voters, OR 1/2 majority of the players.


Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg	2008-10-17 14:58:31 UTC (rev 4777)
+++ trunk/data/defaultNexuiz.cfg	2008-10-18 17:05:32 UTC (rev 4778)
@@ -732,10 +732,10 @@
 set sv_vote_timeout 60
 // a player can not call a vote again for this many seconds
 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
-// which quotient of the players constitute a majority? (try: 0.667, 0.75 when using the above)
+// which quotient of the PLAYERS constitute a majority? (try: 0.667, 0.75 when using the above)
 set sv_vote_majority_factor 0.5
+// which quotient of the VOTERS constitute a majority too? (0 = off, otherwise it must be higher than or equal to sv_vote_majority_factor)
+set sv_vote_simple_majority_factor 0
 // when disabled, don't allow game type changes
 set sv_vote_override_mostrecent 0
 alias vhelp "cmd vote help"

Modified: trunk/data/qcsrc/server/vote.qc
===================================================================
--- trunk/data/qcsrc/server/vote.qc	2008-10-17 14:58:31 UTC (rev 4777)
+++ trunk/data/qcsrc/server/vote.qc	2008-10-18 17:05:32 UTC (rev 4778)
@@ -551,8 +551,9 @@
 		}
 		VoteReset();
 	} else {
-		float votefactor;
+		float votefactor, simplevotefactor;
 		votefactor = bound(0.5, cvar("sv_vote_majority_factor"), 0.999);
+		simplevotefactor = cvar("sv_vote_simple_majority_factor");
 		if(yescount > (playercount - abstaincount) * votefactor)
 		{
 			VoteSpam(yescount, nocount, abstaincount, playercount - yescount - nocount - abstaincount, -1, "yes");
@@ -565,10 +566,11 @@
 		}
 		else if(time > votefinished)
 		{
-			if(cvar("sv_vote_simple_majority"))
+			if(simplevotefactor)
 			{
 				string result;
-				if(yescount > (yescount + nocount) * votefactor)
+				simplevotefactor = bound(votefactor, simplevotefactor, 0.999);
+				if(yescount > (yescount + nocount) * simplevotefactor)
 					result = "yes";
 				else if(yescount + nocount > 0)
 					result = "no";




More information about the nexuiz-commits mailing list