From: terencehill Date: Thu, 18 Feb 2021 17:32:03 +0000 (+0100) Subject: Fix "player is connecting..." message not shown in team games X-Git-Tag: xonotic-v0.8.5~569 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=6f07b9a66403cc921d651ce87305f02426181051;p=xonotic%2Fxonotic-data.pk3dir.git Fix "player is connecting..." message not shown in team games --- diff --git a/qcsrc/server/command/cmd.qc b/qcsrc/server/command/cmd.qc index 362847554..66161af24 100644 --- a/qcsrc/server/command/cmd.qc +++ b/qcsrc/server/command/cmd.qc @@ -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: diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index 43d4d2461..59fa95afa 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -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)); } diff --git a/qcsrc/server/teamplay.qh b/qcsrc/server/teamplay.qh index 1b1562976..279df06fc 100644 --- a/qcsrc/server/teamplay.qh +++ b/qcsrc/server/teamplay.qh @@ -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);