From e7cd2f975492875faa2f26b3b13b8015d53a94d4 Mon Sep 17 00:00:00 2001 From: Mikko Tiusanen Date: Sat, 18 Oct 2014 15:57:56 +0300 Subject: The old team is no longer stored as part of persistent data when leaving team. --- src/game/g_local.h | 2 -- src/game/g_team.c | 17 +++++++++-------- 2 files changed, 9 insertions(+), 10 deletions(-) (limited to 'src/game') diff --git a/src/game/g_local.h b/src/game/g_local.h index 2163df4..522bdb7 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -354,8 +354,6 @@ typedef struct char voice[ MAX_VOICE_NAME_LEN ]; qboolean useUnlagged; - // team change tracking - team_t newTeam; // keep track of other players' info for tinfo char cinfo[ MAX_CLIENTS ][ 16 ]; } clientPersistant_t; diff --git a/src/game/g_team.c b/src/game/g_team.c index a89d043..cea0b25 100644 --- a/src/game/g_team.c +++ b/src/game/g_team.c @@ -166,7 +166,7 @@ void G_UpdateTeamConfigStrings( void ) G_LeaveTeam ================== */ -void G_LeaveTeam( gentity_t *self ) +void G_LeaveTeamReal( gentity_t *self, qboolean reset_score ) { team_t team = self->client->pers.teamSelection; gentity_t *ent; @@ -174,12 +174,12 @@ void G_LeaveTeam( gentity_t *self ) if( team == TEAM_ALIENS ) { G_RemoveFromSpawnQueue( &level.alienSpawnQueue, self->client->ps.clientNum ); - if ( ( self->client->pers.newTeam == TEAM_NONE ) && !level.intermissiontime ) { + if ( reset_score && !level.intermissiontime ) { G_admin_reset_score( self ); } } else if( team == TEAM_HUMANS ) { G_RemoveFromSpawnQueue( &level.humanSpawnQueue, self->client->ps.clientNum ); - if ( ( self->client->pers.newTeam == TEAM_NONE ) && !level.intermissiontime ) { + if ( reset_score && !level.intermissiontime ) { G_admin_reset_score( self ); } } else { @@ -224,11 +224,14 @@ void G_LeaveTeam( gentity_t *self ) G_namelog_update_score( self->client ); - ent->client->pers.newTeam = TEAM_NONE; - admin_writeconfig(); } +void G_LeaveTeam( gentity_t *self ) +{ + G_LeaveTeamReal( self, qtrue ); +} + /* ================= G_ChangeTeam @@ -241,9 +244,7 @@ void G_ChangeTeam( gentity_t *ent, team_t newTeam ) if( oldTeam == newTeam ) return; - ent->client->pers.newTeam = newTeam; - G_LeaveTeam( ent ); - ent->client->pers.newTeam = TEAM_NONE; + G_LeaveTeamReal( ent, ( newTeam == TEAM_NONE ) ? qtrue : qfalse ); ent->client->pers.teamChangeTime = level.time; ent->client->pers.teamSelection = newTeam; -- cgit