r4146 - trunk/data/qcsrc/server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Fri Aug 22 12:12:19 EDT 2008
Author: div0
Date: 2008-08-22 12:12:19 -0400 (Fri, 22 Aug 2008)
New Revision: 4146
Modified:
trunk/data/qcsrc/server/g_world.qc
trunk/data/qcsrc/server/scores.qc
trunk/data/qcsrc/server/scores.qh
Log:
try to fix autojoin
Modified: trunk/data/qcsrc/server/g_world.qc
===================================================================
--- trunk/data/qcsrc/server/g_world.qc 2008-08-22 15:57:50 UTC (rev 4145)
+++ trunk/data/qcsrc/server/g_world.qc 2008-08-22 16:12:19 UTC (rev 4146)
@@ -1477,6 +1477,14 @@
// TODO make everything use THIS winning condition (except LMS)
WinningConditionHelper();
+ if(teams_matter)
+ {
+ team1_score = TeamScore_GetCompareValue(COLOR_TEAM1);
+ team2_score = TeamScore_GetCompareValue(COLOR_TEAM2);
+ team3_score = TeamScore_GetCompareValue(COLOR_TEAM3);
+ team4_score = TeamScore_GetCompareValue(COLOR_TEAM4);
+ }
+
ClearWinners();
if(WinningConditionHelper_winner)
WinningConditionHelper_winner.winning = 1;
@@ -1491,7 +1499,7 @@
WinningConditionHelper_topscore = -WinningConditionHelper_topscore;
limit = -limit;
}
-
+
return GetWinningCode(limit && WinningConditionHelper_topscore && (WinningConditionHelper_topscore >= limit), WinningConditionHelper_equality);
}
Modified: trunk/data/qcsrc/server/scores.qc
===================================================================
--- trunk/data/qcsrc/server/scores.qc 2008-08-22 15:57:50 UTC (rev 4145)
+++ trunk/data/qcsrc/server/scores.qc 2008-08-22 16:12:19 UTC (rev 4146)
@@ -613,3 +613,23 @@
return i;
}
+
+float TeamScore_GetCompareValue(float t)
+{
+ float s;
+ entity sk;
+
+ if(t <= 0 || t >= 16)
+ error("Reading score of invalid team!");
+
+ sk = teamscorekeepers[t - 1];
+ if not(sk)
+ return -999999999;
+ s = sk.teamscores_primary;
+ if(teamscores_flags_primary & SFL_ZERO_IS_WORST)
+ if(!s)
+ return -999999999;
+ if(teamscores_flags_primary & SFL_LOWER_IS_BETTER)
+ s = -s;
+ return s;
+}
Modified: trunk/data/qcsrc/server/scores.qh
===================================================================
--- trunk/data/qcsrc/server/scores.qh 2008-08-22 15:57:50 UTC (rev 4145)
+++ trunk/data/qcsrc/server/scores.qh 2008-08-22 16:12:19 UTC (rev 4146)
@@ -41,6 +41,11 @@
float TeamScore_AddToTeam(float t, float scorefield, float score);
/**
+ * Returns a value indicating the team score (and higher is better).
+ */
+float TeamScore_GetCompareValue(float t);
+
+/**
* Adds a score to both the player and the team. Returns the team score if
* possible, otherwise the player score.
*/
More information about the nexuiz-commits
mailing list