summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cgame/cg_local.h1
-rw-r--r--src/cgame/cg_players.c52
-rw-r--r--src/game/g_client.c2
3 files changed, 18 insertions, 37 deletions
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h
index 0eac4db7..5d296fe0 100644
--- a/src/cgame/cg_local.h
+++ b/src/cgame/cg_local.h
@@ -1645,7 +1645,6 @@ void CG_Corpse( centity_t *cent );
void CG_ResetPlayerEntity( centity_t *cent );
void CG_NewClientInfo( int clientNum );
void CG_PrecacheClientInfo( class_t class, char *model, char *skin );
-void CG_TeamJoinMessage( clientInfo_t *newInfo, clientInfo_t *ci );
sfxHandle_t CG_CustomSound( int clientNum, const char *soundName );
void CG_PlayerDisconnect( vec3_t org );
void CG_Bleed( vec3_t origin, vec3_t normal, int entityNum );
diff --git a/src/cgame/cg_players.c b/src/cgame/cg_players.c
index f05c9025..d22a87d8 100644
--- a/src/cgame/cg_players.c
+++ b/src/cgame/cg_players.c
@@ -721,52 +721,35 @@ void CG_PrecacheClientInfo( class_t class, char *model, char *skin )
CG_LoadClientInfo( ci );
}
-
/*
=============
-CG_TeamJoinMessage
+CG_StatusMessages
-Prints messages when players change teams
+Print messages for player status changes
=============
*/
-void CG_TeamJoinMessage( clientInfo_t *newInfo, clientInfo_t *ci )
+static void CG_StatusMessages( clientInfo_t *new, clientInfo_t *old )
{
- int team;
- int oldteam;
- char *playerName;
-
- if( !ci->infoValid )
+ if( !old->infoValid )
return;
- // Collect info
- team = newInfo->team;
- oldteam = ci->team;
+ if( strcmp( new->name, old->name ) )
+ CG_Printf( "%s" S_COLOR_WHITE " renamed to %s\n", old->name, new->name );
- // If no change occurred, print nothing
- if( team == oldteam )
- return;
-
- playerName = newInfo->name;
-
- // Print the appropriate message
- if( team == TEAM_NONE )
- {
- CG_Printf( "%s" S_COLOR_WHITE " left the %ss\n",
- playerName, BG_TeamName( oldteam ) );
- }
- else if( oldteam == TEAM_NONE )
- {
- CG_Printf( "%s" S_COLOR_WHITE " joined the %ss\n",
- playerName, BG_TeamName( team ) );
- }
- else
+ if( old->team != new->team )
{
- CG_Printf( "%s" S_COLOR_WHITE " left the %ss and joined the %ss\n",
- playerName, BG_TeamName( oldteam ), BG_TeamName( team ) );
+ if( new->team == TEAM_NONE )
+ CG_Printf( "%s" S_COLOR_WHITE " left the %ss\n", new->name,
+ BG_TeamName( old->team ) );
+ else if( old->team == TEAM_NONE )
+ CG_Printf( "%s" S_COLOR_WHITE " joined the %ss\n", new->name,
+ BG_TeamName( new->team ) );
+ else
+ CG_Printf( "%s" S_COLOR_WHITE " left the %ss and joined the %ss\n",
+ new->name, BG_TeamName( old->team ), BG_TeamName( new->team ) );
}
}
-
/*
======================
CG_NewClientInfo
@@ -817,7 +800,6 @@ void CG_NewClientInfo( int clientNum )
// team
v = Info_ValueForKey( configstring, "t" );
newInfo.team = atoi( v );
- CG_TeamJoinMessage( &newInfo, ci );
// if this is us, execute team-specific config files
// unfortunately, these get re-executed after a vid_restart, because the
@@ -857,6 +839,8 @@ void CG_NewClientInfo( int clientNum )
v = Info_ValueForKey( configstring, "v" );
Q_strncpyz( newInfo.voice, v, sizeof( newInfo.voice ) );
+ CG_StatusMessages( &newInfo, ci );
+
// replace whatever was there with the new one
newInfo.infoValid = qtrue;
*ci = newInfo;
diff --git a/src/game/g_client.c b/src/game/g_client.c
index 8d0e212c..58238880 100644
--- a/src/game/g_client.c
+++ b/src/game/g_client.c
@@ -1060,8 +1060,6 @@ void ClientUserinfoChanged( int clientNum )
}
if( *oldname )
{
- trap_SendServerCommand( -1, va( "print \"%s" S_COLOR_WHITE
- " renamed to %s\n\"", oldname, client->pers.netname ) );
G_LogPrintf( "ClientRename: %i [%s] (%s) \"%s^7\" -> \"%s^7\" \"%c%s%c^7\"\n",
clientNum, client->pers.ip.str, client->pers.guid,
oldname, client->pers.netname,