]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fixed JoinBestTeam.
authorLyberta <lyberta@lyberta.net>
Wed, 25 Jul 2018 15:42:54 +0000 (18:42 +0300)
committerLyberta <lyberta@lyberta.net>
Wed, 25 Jul 2018 15:42:54 +0000 (18:42 +0300)
qcsrc/server/bot/default/bot.qc
qcsrc/server/client.qc
qcsrc/server/teamplay.qc
qcsrc/server/teamplay.qh

index 2b427f4fbc81580d91cd4037ec960a002db40d68..50c4fd06a775038394b4ce56792b00a11635c39b 100644 (file)
@@ -238,7 +238,7 @@ void bot_setnameandstuff(entity this)
 
        this.bot_config_loaded = true;
 
-       // this is really only a default, JoinBestTeam is called later
+       // this is really only a default, TeamBalance_JoinBestTeam is called later
        setcolor(this, stof(bot_shirt) * 16 + stof(bot_pants));
        this.bot_preferredcolors = this.clientcolors;
 
@@ -431,7 +431,7 @@ void bot_clientconnect(entity this)
        else if(this.bot_forced_team==4)
                this.team = NUM_TEAM_4;
        else
-               TeamBalance_JoinBestTeam(this, true);
+               TeamBalance_JoinBestTeam(this);
 
        havocbot_setupbot(this);
 }
index 53a203eb9dfee4fc835efdef4d4663be0f0f21c8..c356c359fc9f6041eb93ab770b5f4a7839d28afb 100644 (file)
@@ -519,7 +519,7 @@ void PutPlayerInServer(entity this)
        accuracy_resend(this);
 
        if (this.team < 0)
-               TeamBalance_JoinBestTeam(this, true);
+               TeamBalance_JoinBestTeam(this);
 
        entity spot = SelectSpawnPoint(this, false);
        if (!spot) {
@@ -913,7 +913,7 @@ void ClientKill_Now_TeamChange(entity this)
 {
        if(this.killindicator_teamchange == -1)
        {
-               TeamBalance_JoinBestTeam(this, true);
+               TeamBalance_JoinBestTeam(this);
        }
        else if(this.killindicator_teamchange == -2)
        {
@@ -1298,7 +1298,6 @@ void ClientConnect(entity this)
 
        int playerid_save = this.playerid;
        this.playerid = 0; // silent
-       TeamBalance_JoinBestTeam(this, false); // if the team number is valid, keep it
        this.playerid = playerid_save;
 
        TRANSMUTE(Observer, this);
@@ -1314,8 +1313,6 @@ void ClientConnect(entity this)
        if (autocvar_sv_eventlog)
                GameLogEcho(strcat(":join:", ftos(this.playerid), ":", ftos(etof(this)), ":", ((IS_REAL_CLIENT(this)) ? this.netaddress : "bot"), ":", playername(this, false)));
 
-       LogTeamchange(this.playerid, this.team, TEAM_CHANGE_CONNECT);
-
        CS(this).just_joined = true;  // stop spamming the eventlog with additional lines when the client connects
 
        if(teamplay && IS_PLAYER(this))
@@ -2121,7 +2118,7 @@ void Join(entity this)
 
        if(!this.team_selected)
        if(autocvar_g_campaign || autocvar_g_balance_teams)
-               TeamBalance_JoinBestTeam(this, true);
+               TeamBalance_JoinBestTeam(this);
 
        if(autocvar_g_campaign)
                campaign_bots_may_start = true;
index 25acdd3e01595b82a8f584c44bb8f8a72bf1e2d0..c7fbacc488b2cf2935994851b7b437e96a215420 100644 (file)
@@ -631,9 +631,9 @@ int TeamBalance_FindBestTeams(entity balance, entity player, bool use_score)
        return team_bits;
 }
 
-void TeamBalance_JoinBestTeam(entity this, bool force_best_team)
+void TeamBalance_JoinBestTeam(entity this)
 {
-       //PrintToChatAll(sprintf("JoinBestTeam: %s, %f", this.netname, force_best_team));
+       PrintToChatAll(sprintf("JoinBestTeam: %s, %f", this.netname));
        // don't join a team if we're not playing a team game
        if (!teamplay)
        {
@@ -643,29 +643,6 @@ void TeamBalance_JoinBestTeam(entity this, bool force_best_team)
        // find out what teams are available
        entity balance = TeamBalance_CheckAllowedTeams(this);
 
-       // if we don't care what team they end up on, put them on whatever team they entered as.
-       // if they're not on a valid team, then let other code put them on the smallest team
-       if (!force_best_team)
-       {
-               int selected_team_index = -1;
-               for (int i = 1; i <= NUM_TEAMS; ++i)
-               {
-                       if (TeamBalance_IsTeamAllowedInternal(balance, i) &&
-                               (Team_TeamToIndex(this.team) == i))
-                       {
-                               selected_team_index = i;
-                               break;
-                       }
-               }
-               
-               if (Team_IsValidIndex(selected_team_index))
-               {
-                       SetPlayerTeam(this, selected_team_index, TEAM_CHANGE_AUTO_RELAXED);
-                       TeamBalance_Destroy(balance);
-                       return;
-               }
-       }
-       // otherwise end up on the smallest team (handled below)
        if (this.bot_forced_team)
        {
                TeamBalance_Destroy(balance);
index f0ad95ce18b7e421a51b40dbacb8e9026d987d50..776a80d329cf91d5917f1af4e1ba7275eb18a731 100644 (file)
@@ -103,11 +103,9 @@ void KillPlayerForTeamChange(entity player);
 
 enum
 {
-       TEAM_CHANGE_CONNECT = 1,
        TEAM_CHANGE_AUTO = 2,
        TEAM_CHANGE_MANUAL = 3,
-       TEAM_CHANGE_SPECTATOR = 4,
-       TEAM_CHANGE_AUTO_RELAXED = 99
+       TEAM_CHANGE_SPECTATOR = 4
 };
 
 void LogTeamchange(float player_id, float team_number, int type);
@@ -176,7 +174,7 @@ int TeamBalance_FindBestTeam(entity balance, entity player, bool ignore_player);
 /// function.
 int TeamBalance_FindBestTeams(entity balance, entity player, bool use_score);
 
-void TeamBalance_JoinBestTeam(entity this, bool force_best_team);
+void TeamBalance_JoinBestTeam(entity this);
 
 /// \brief Describes the result of comparing teams.
 enum