]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix "player is connecting..." message not shown in team games
authorterencehill <piuntn@gmail.com>
Thu, 18 Feb 2021 17:32:03 +0000 (18:32 +0100)
committerterencehill <piuntn@gmail.com>
Thu, 18 Feb 2021 17:32:03 +0000 (18:32 +0100)
qcsrc/server/command/cmd.qc
qcsrc/server/teamplay.qc
qcsrc/server/teamplay.qh

index 362847554220cbdf6a095916475f9884f4d6499e..66161af241a0bbf39c5375a9ea7a5eb4f94aef47 100644 (file)
@@ -899,7 +899,15 @@ void SV_ParseClientCommand(entity this, string command)
                case "prespawn": break;                            // handled by engine in host_cmd.c
                case "sentcvar": break;                            // handled by server in this file
                case "spawn": break;                               // handled by engine in host_cmd.c
-               case "color": case "topcolor": case "bottomcolor": if(teamplay) return; else break; // handled by engine in host_cmd.c
+               case "color": case "topcolor": case "bottomcolor": // handled by engine in host_cmd.c
+                       if(!IS_CLIENT(this)) // on connection
+                       {
+                               // since gamecode doesn't have any calls earlier than this, do the connecting message here
+                               Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_CONNECTING, this.netname);
+                       }
+                       if(teamplay)
+                               return;
+                       break;
                case "c2s": Net_ClientCommand(this, command); return; // handled by net.qh
 
                default:
index 43d4d2461fbb141585102ca9735f9e071b9b6339..59fa95afacf4ca97224f9cf8bb8dab5e8e4dc575 100644 (file)
@@ -1123,18 +1123,13 @@ void SV_ChangeTeam(entity player, int new_color)
        {
                SetPlayerColors(player, new_color);
        }
-       // TODO: Should we really bother with this?
        if(!IS_CLIENT(player))
        {
-               // since this is an engine function, and gamecode doesn't have any calls earlier than this, do the connecting message here
-               Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_CONNECTING,
-                       player.netname);
                return;
        }
        if (!teamplay)
        {
                return;
        }
-       Player_SetTeamIndexChecked(player, Team_TeamToIndex((new_color & 0x0F) +
-               1));
+       Player_SetTeamIndexChecked(player, Team_TeamToIndex((new_color & 0x0F) + 1));
 }
index 1b1562976b6cea4a38906b07ca896afe86c556ce..279df06fc303a8e766fa182d6eb90f2313b81cc6 100644 (file)
@@ -321,8 +321,8 @@ int TeamBalanceTeam_GetNumberOfBots(entity team_ent);
 int TeamBalance_CompareTeamsInternal(entity team_a, entity team_index_b,
        entity player, bool use_score);
 
-/// \brief Called when the player connects or when they change their color with
-/// the "color" command.
+/// \brief Called when the player changes color with the "color" command.
+/// Note that the "color" command is always called early on player connection
 /// \param[in,out] player Player that requested a new color.
 /// \param[in] new_color Requested color.
 void SV_ChangeTeam(entity player, int new_color);