From: Lyberta Date: Wed, 2 Aug 2017 03:54:10 +0000 (+0300) Subject: Renamed lowestplayerteamX to lowesthumanteamX. X-Git-Tag: xonotic-v0.8.5~2482^2~12 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=318d8daa1b4930048eafe11a0ac7da16df196e68;p=xonotic%2Fxonotic-data.pk3dir.git Renamed lowestplayerteamX to lowesthumanteamX. --- diff --git a/qcsrc/server/mutators/events.qh b/qcsrc/server/mutators/events.qh index 6522c46b3..ec5d3f1ec 100644 --- a/qcsrc/server/mutators/events.qh +++ b/qcsrc/server/mutators/events.qh @@ -141,7 +141,7 @@ MUTATOR_HOOKABLE(GetTeamCounts, EV_NO_ARGS); /**/ o(float, MUTATOR_ARGV_2_float) \ /** number of bots in a team */ i(float, MUTATOR_ARGV_3_float) \ /**/ o(float, MUTATOR_ARGV_3_float) \ - /** lowest scoring player in a team */ i(entity, MUTATOR_ARGV_4_entity) \ + /** lowest scoring human in a team */ i(entity, MUTATOR_ARGV_4_entity) \ /**/ o(entity, MUTATOR_ARGV_4_entity) \ /** lowest scoring bot in a team */ i(entity, MUTATOR_ARGV_5_entity) \ /**/ o(entity, MUTATOR_ARGV_5_entity) \ diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index 61e2690c8..da53e57e5 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -333,37 +333,37 @@ void GetTeamCounts(entity ignore) if (c1 >= 0) { MUTATOR_CALLHOOK(GetTeamCount, NUM_TEAM_1, ignore, c1, numbotsteam1, - lowestplayerteam1, lowestbotteam1); + lowesthumanteam1, lowestbotteam1); c1 = M_ARGV(2, float); numbotsteam1 = M_ARGV(3, float); - lowestplayerteam1 = M_ARGV(4, entity); + lowesthumanteam1 = M_ARGV(4, entity); lowestbotteam1 = M_ARGV(5, entity); } if (c2 >= 0) { MUTATOR_CALLHOOK(GetTeamCount, NUM_TEAM_2, ignore, c2, numbotsteam2, - lowestplayerteam2, lowestbotteam2); + lowesthumanteam2, lowestbotteam2); c2 = M_ARGV(2, float); numbotsteam2 = M_ARGV(3, float); - lowestplayerteam2 = M_ARGV(4, entity); + lowesthumanteam2 = M_ARGV(4, entity); lowestbotteam2 = M_ARGV(5, entity); } if (c3 >= 0) { MUTATOR_CALLHOOK(GetTeamCount, NUM_TEAM_3, ignore, c3, numbotsteam3, - lowestplayerteam3, lowestbotteam3); + lowesthumanteam3, lowestbotteam3); c3 = M_ARGV(2, float); numbotsteam3 = M_ARGV(3, float); - lowestplayerteam3 = M_ARGV(4, entity); + lowesthumanteam3 = M_ARGV(4, entity); lowestbotteam3 = M_ARGV(5, entity); } if (c4 >= 0) { MUTATOR_CALLHOOK(GetTeamCount, NUM_TEAM_4, ignore, c4, numbotsteam4, - lowestplayerteam4, lowestbotteam4); + lowesthumanteam4, lowestbotteam4); c4 = M_ARGV(2, float); numbotsteam4 = M_ARGV(3, float); - lowestplayerteam4 = M_ARGV(4, entity); + lowesthumanteam4 = M_ARGV(4, entity); lowestbotteam4 = M_ARGV(5, entity); } } @@ -371,15 +371,16 @@ void GetTeamCounts(entity ignore) { float value, bvalue; // now count how many players are on each team already - float lowestplayerscore1 = FLOAT_MAX; + float lowesthumanscore1 = FLOAT_MAX; float lowestbotscore1 = FLOAT_MAX; - float lowestplayerscore2 = FLOAT_MAX; + float lowesthumanscore2 = FLOAT_MAX; float lowestbotscore2 = FLOAT_MAX; - float lowestplayerscore3 = FLOAT_MAX; + float lowesthumanscore3 = FLOAT_MAX; float lowestbotscore3 = FLOAT_MAX; - float lowestplayerscore4 = FLOAT_MAX; + float lowesthumanscore4 = FLOAT_MAX; float lowestbotscore4 = FLOAT_MAX; - FOREACH_CLIENT(true, LAMBDA( + FOREACH_CLIENT(true, + { float t; if (IS_PLAYER(it) || it.caplayer) { @@ -423,10 +424,10 @@ void GetTeamCounts(entity ignore) float tempscore = PlayerScore_Get(it, SP_SCORE); if (!bvalue) { - if (tempscore < lowestplayerscore1) + if (tempscore < lowesthumanscore1) { - lowestplayerteam1 = it; - lowestplayerscore1 = tempscore; + lowesthumanteam1 = it; + lowesthumanscore1 = tempscore; } break; } @@ -448,10 +449,10 @@ void GetTeamCounts(entity ignore) float tempscore = PlayerScore_Get(it, SP_SCORE); if (!bvalue) { - if (tempscore < lowestplayerscore2) + if (tempscore < lowesthumanscore2) { - lowestplayerteam2 = it; - lowestplayerscore2 = tempscore; + lowesthumanteam2 = it; + lowesthumanscore2 = tempscore; } break; } @@ -473,10 +474,10 @@ void GetTeamCounts(entity ignore) float tempscore = PlayerScore_Get(it, SP_SCORE); if (!bvalue) { - if (tempscore < lowestplayerscore3) + if (tempscore < lowesthumanscore3) { - lowestplayerteam3 = it; - lowestplayerscore3 = tempscore; + lowesthumanteam3 = it; + lowesthumanscore3 = tempscore; } break; } @@ -498,10 +499,10 @@ void GetTeamCounts(entity ignore) float tempscore = PlayerScore_Get(it, SP_SCORE); if (!bvalue) { - if (tempscore < lowestplayerscore4) + if (tempscore < lowesthumanscore4) { - lowestplayerteam4 = it; - lowestplayerscore4 = tempscore; + lowesthumanteam4 = it; + lowesthumanscore4 = tempscore; } break; } @@ -513,7 +514,7 @@ void GetTeamCounts(entity ignore) break; } } - )); + }); } // if the player who has a forced team has not joined yet, reserve the spot diff --git a/qcsrc/server/teamplay.qh b/qcsrc/server/teamplay.qh index 5d1130d5e..44f54fa91 100644 --- a/qcsrc/server/teamplay.qh +++ b/qcsrc/server/teamplay.qh @@ -5,19 +5,22 @@ string cache_lastmutatormsg; // client counts for each team //float c1, c2, c3, c4; -// # of bots on those teams -float numbotsteam1; -float numbotsteam2; -float numbotsteam3; -float numbotsteam4; -entity lowestplayerteam1; -entity lowestplayerteam2; -entity lowestplayerteam3; -entity lowestplayerteam4; -entity lowestbotteam1; -entity lowestbotteam2; -entity lowestbotteam3; -entity lowestbotteam4; + +// The following variables are used for balancing. They are not updated +// automatically. You need to call CheckAllowedTeams and GetTeamCounts to get +// proper values. +float numbotsteam1; ///< Number of bots in the first team. +float numbotsteam2; ///< Number of bots in the second team. +float numbotsteam3; ///< Number of bots in the third team. +float numbotsteam4; ///< Number of bots in the fourth team. +entity lowesthumanteam1; ///< Human with the lowest score in the first team. +entity lowesthumanteam2; ///< Human with the lowest score in the second team. +entity lowesthumanteam3; ///< Human with the lowest score in the third team. +entity lowesthumanteam4; ///< Human with the lowest score in the fourth team. +entity lowestbotteam1; ///< Bot with the lowest score in the first team. +entity lowestbotteam2; ///< Bot with the lowest score in the second team. +entity lowestbotteam3; ///< Bot with the lowest score in the third team. +entity lowestbotteam4; ///< Bot with the lowest score in the fourth team. int redowned, blueowned, yellowowned, pinkowned;