[nexuiz-commits] r7221 - trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Wed Jul 15 05:04:36 EDT 2009


Author: div0
Date: 2009-07-15 05:04:35 -0400 (Wed, 15 Jul 2009)
New Revision: 7221

Modified:
   trunk/data/qcsrc/server/g_world.qc
   trunk/data/qcsrc/server/race.qc
   trunk/data/qcsrc/server/race.qh
Log:
race: when time limit ends, do not stop the race, but let everyone finish his lap (untested, please test)


Modified: trunk/data/qcsrc/server/g_world.qc
===================================================================
--- trunk/data/qcsrc/server/g_world.qc	2009-07-15 00:31:33 UTC (rev 7220)
+++ trunk/data/qcsrc/server/g_world.qc	2009-07-15 09:04:35 UTC (rev 7221)
@@ -1379,7 +1379,6 @@
 float checkrules_suddendeathwarning;
 float checkrules_suddendeathend;
 float checkrules_overtimesadded; //how many overtimes have been already added
-float checkrules_status;
 
 float WINNING_NO = 0; // no winner, but time limits may terminate the game
 float WINNING_YES = 1; // winner found
@@ -1392,7 +1391,7 @@
 	// - for this timelimit_overtime needs to be >0 of course
 	// - also check the winning condition calculated in the previous frame and only add normal overtime
 	//   again, if at the point at which timelimit would be extended again, still no winner was found
-	if ((checkrules_overtimesadded < cvar("timelimit_overtimes")) && cvar("timelimit_overtime") && (checkrules_status == WINNING_NEVER)) 
+	if ((checkrules_overtimesadded >= 0) && (checkrules_overtimesadded < cvar("timelimit_overtimes")) && cvar("timelimit_overtime") && !(g_race && !g_race_qualifying))
 	{
 		++checkrules_overtimesadded;
 		//add one more overtime by simply extending the timelimit
@@ -1418,7 +1417,11 @@
 	else 
 	{
 		if(!checkrules_suddendeathend)
+		{
 			checkrules_suddendeathend = time + 60 * cvar("timelimit_suddendeath");
+			if(g_race && !g_race_qualifying)
+				race_StartCompleting();
+		}
 	}
 }
 
@@ -1713,17 +1716,26 @@
 {
 	float wc;
 	entity p;
+	float n, c;
+
+	n = 0;
+	c = 0;
+	FOR_EACH_PLAYER(p)
+	{
+		++n;
+		if not(p.race_completed)
+			++c;
+	}
+	if(n && (n == c))
+		return WINNING_YES;
 	wc = WinningCondition_Scores(fraglimit, 0);
 
 	// ALWAYS initiate overtime, unless EVERYONE has finished the race!
 	if(wc == WINNING_YES || wc == WINNING_STARTSUDDENDEATHOVERTIME)
 	// do NOT support equality when the laps are all raced!
-	{
-		FOR_EACH_PLAYER(p)
-			if not(p.race_completed)
-				return WINNING_STARTSUDDENDEATHOVERTIME;
-		return WINNING_YES;
-	}
+		return WINNING_STARTSUDDENDEATHOVERTIME;
+	else
+		return WINNING_NEVER;
 	return wc;
 }
 
@@ -1921,6 +1933,7 @@
 		return;
 	}
 
+	float checkrules_status;
 	checkrules_status = WinningCondition_RanOutOfSpawns();
 	if(checkrules_status == WINNING_YES)
 	{
@@ -1953,7 +1966,7 @@
 
 	if(checkrules_status == WINNING_STARTSUDDENDEATHOVERTIME)
 	{
-		checkrules_status = WINNING_NEVER;
+		checkrules_overtimesadded = -1;
 		InitiateOvertime();
 	}
 

Modified: trunk/data/qcsrc/server/race.qc
===================================================================
--- trunk/data/qcsrc/server/race.qc	2009-07-15 00:31:33 UTC (rev 7220)
+++ trunk/data/qcsrc/server/race.qc	2009-07-15 09:04:35 UTC (rev 7221)
@@ -127,12 +127,7 @@
 
 			if(cvar("fraglimit"))
 				if(l >= cvar("fraglimit"))
-				{
-					race_completing = 1;
-					FOR_EACH_PLAYER(p)
-						if(p.deadflag != DEAD_NO)
-							race_AbandonRaceCheck(p);
-				}
+					race_StartCompleting();
 
 			if(race_completing)
 			{
@@ -561,6 +556,15 @@
 	}
 }
 
+void race_StartCompleting()
+{
+	entity p;
+	race_completing = 1;
+	FOR_EACH_PLAYER(p)
+		if(p.deadflag != DEAD_NO)
+			race_AbandonRaceCheck(p);
+}
+
 void race_PreparePlayer()
 {
 	race_ClearTime(self);

Modified: trunk/data/qcsrc/server/race.qh
===================================================================
--- trunk/data/qcsrc/server/race.qh	2009-07-15 00:31:33 UTC (rev 7220)
+++ trunk/data/qcsrc/server/race.qh	2009-07-15 09:04:35 UTC (rev 7221)
@@ -18,3 +18,4 @@
 .float race_completed;
 float race_completing;
 void race_ImposePenaltyTime(entity pl, float penalty, string reason);
+void race_StartCompleting();



More information about the nexuiz-commits mailing list