r4114 - trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Tue Aug 12 01:31:43 EDT 2008


Author: div0
Date: 2008-08-12 01:31:43 -0400 (Tue, 12 Aug 2008)
New Revision: 4114

Modified:
   trunk/data/qcsrc/server/g_world.qc
Log:
if at the end of the qualifying time, 2/3 of the players (3 or more) had completed a lap - start the race instead of ending the match


Modified: trunk/data/qcsrc/server/g_world.qc
===================================================================
--- trunk/data/qcsrc/server/g_world.qc	2008-08-11 20:00:25 UTC (rev 4113)
+++ trunk/data/qcsrc/server/g_world.qc	2008-08-12 05:31:43 UTC (rev 4114)
@@ -1513,6 +1513,43 @@
 	return wc;
 }
 
+void ReadyRestart();
+float WinningCondition_QualifyingThenRace()
+{
+	float wc;
+	wc = WinningCondition_Scores(0);
+
+	// NEVER initiate overtime
+	if(wc == WINNING_YES || wc == WINNING_STARTOVERTIME)
+	// do NOT support equality when the laps are all raced!
+	{
+		float totalplayers;
+		float playerswithlaps;
+		entity head;
+		totalplayers = playerswithlaps = 0;
+		FOR_EACH_PLAYER(head)
+		{
+			++totalplayers;
+			if(PlayerScore_Add(head, SP_RACE_FASTEST, 0))
+				++playerswithlaps;
+		}
+
+		// at least 2/3 of the players have completed a lap: start the RACE
+		// otherwise, the players should end the qualifying on their own
+		if(totalplayers >= 3)
+		if(playerswithlaps >= totalplayers * 2 / 3)
+		{
+			checkrules_overtimeend = 0;
+			ReadyRestart();
+			return WINNING_NEVER;
+		}
+
+		return WINNING_YES;
+	}
+
+	return wc;
+}
+
 float WinningCondition_RanOutOfSpawns()
 {
 	entity head;
@@ -1658,6 +1695,10 @@
 	{
 		status = WinningCondition_Race(fraglimit);
 	}
+	else if(g_race && g_race_qualifying == 2 && timelimit > 0)
+	{
+		status = WinningCondition_QualifyingThenRace();
+	}
 	else if(g_assault)
 	{
 		status = WinningCondition_Assault(); // TODO remove this?




More information about the nexuiz-commits mailing list