summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorM. Kristall <mkpdev@gmail.com>2009-10-03 12:08:32 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:15:42 +0000
commit503d73977f1117991369bed0ff31fd56744b976c (patch)
tree264bf11bc2e154c53363ac94c41411b882520d1a /src
parent82f7c11748f391a183855f78b2afdd59c6ffb4f8 (diff)
* Add functions G_TeamName and G_TeamFromString
* Log team changes whenever a team change occurs (not just when using /team) * Do not allow admins without ADMF_CAN_PERM_BAN (flag 8) to remove or modify permanent bans
Diffstat (limited to 'src')
-rw-r--r--src/game/g_admin.c80
-rw-r--r--src/game/g_buildable.c4
-rw-r--r--src/game/g_cmds.c269
-rw-r--r--src/game/g_local.h6
-rw-r--r--src/game/g_team.c135
5 files changed, 236 insertions, 258 deletions
diff --git a/src/game/g_admin.c b/src/game/g_admin.c
index 71898d1b..ca201d8d 100644
--- a/src/game/g_admin.c
+++ b/src/game/g_admin.c
@@ -1812,6 +1812,12 @@ qboolean G_admin_unban( gentity_t *ent, int skiparg )
ADMP( "^3!unban: ^7invalid ban#\n" );
return qfalse;
}
+ if( g_admin_bans[ bnum - 1 ]->expires == 0 &&
+ !G_admin_permission( ent, ADMF_CAN_PERM_BAN ) )
+ {
+ ADMP( "^3!unban: ^7you cannot remove permanent bans\n" );
+ return qfalse;
+ }
g_admin_bans[ bnum - 1 ]->expires = trap_RealTime( NULL );
AP( va( "print \"^3!unban: ^7ban #%d for %s^7 has been removed by %s\n\"",
bnum,
@@ -1848,7 +1854,11 @@ qboolean G_admin_adjustban( gentity_t *ent, int skiparg )
return qfalse;
}
ban = g_admin_bans[ bnum - 1 ];
-
+ if( ban->expires == 0 && !G_admin_permission( ent, ADMF_CAN_PERM_BAN ) )
+ {
+ ADMP( "^3!adjustban: ^7you cannot modify permanent bans\n" );
+ return qfalse;
+ }
G_SayArgv( 2 + skiparg, secs, sizeof( secs ) );
if( secs[ 0 ] == '+' || secs[ 0 ] == '-' )
mode = secs[ 0 ];
@@ -1914,7 +1924,6 @@ qboolean G_admin_putteam( gentity_t *ent, int skiparg )
char name[ MAX_NAME_LENGTH ], team[ 7 ], err[ MAX_STRING_CHARS ];
gentity_t *vic;
team_t teamnum = TEAM_NONE;
- char teamdesc[ 32 ] = {"spectators"};
G_SayArgv( 1 + skiparg, name, sizeof( name ) );
G_SayArgv( 2 + skiparg, team, sizeof( team ) );
@@ -1937,21 +1946,10 @@ qboolean G_admin_putteam( gentity_t *ent, int skiparg )
return qfalse;
}
vic = &g_entities[ pids[ 0 ] ];
- switch( team[ 0 ] )
- {
- case 'a':
- teamnum = TEAM_ALIENS;
- Q_strncpyz( teamdesc, "aliens", sizeof( teamdesc ) );
- break;
- case 'h':
- teamnum = TEAM_HUMANS;
- Q_strncpyz( teamdesc, "humans", sizeof( teamdesc ) );
- break;
- case 's':
- teamnum = TEAM_NONE;
- break;
- default:
- ADMP( va( "^3!putteam: ^7unknown team %c\n", team[ 0 ] ) );
+ teamnum = G_TeamFromString( team );
+ if( teamnum == NUM_TEAMS )
+ {
+ ADMP( va( "^3!putteam: ^7unknown team %s\n", team ) );
return qfalse;
}
if( vic->client->pers.teamSelection == teamnum )
@@ -1960,7 +1958,7 @@ qboolean G_admin_putteam( gentity_t *ent, int skiparg )
AP( va( "print \"^3!putteam: ^7%s^7 put %s^7 on to the %s team\n\"",
( ent ) ? ent->client->pers.netname : "console",
- vic->client->pers.netname, teamdesc ) );
+ vic->client->pers.netname, G_TeamName( teamnum ) ) );
return qtrue;
}
@@ -2906,21 +2904,13 @@ qboolean G_admin_lock( gentity_t *ent, int skiparg )
return qfalse;
}
G_SayArgv( 1 + skiparg, teamName, sizeof( teamName ) );
- if( teamName[ 0 ] == 'a' || teamName[ 0 ] == 'A' )
- team = TEAM_ALIENS;
- else if( teamName[ 0 ] == 'h' || teamName[ 0 ] == 'H' )
- team = TEAM_HUMANS;
- else
- {
- ADMP( va( "^3!lock: ^7invalid team\"%c\"\n", teamName[0] ) );
- return qfalse;
- }
+ team = G_TeamFromString( teamName );
if( team == TEAM_ALIENS )
{
if( level.alienTeamLocked )
{
- ADMP( "^3!lock: ^7Alien team is already locked\n" );
+ ADMP( "^3!lock: ^7the alien team is already locked\n" );
return qfalse;
}
else
@@ -2929,15 +2919,20 @@ qboolean G_admin_lock( gentity_t *ent, int skiparg )
else if( team == TEAM_HUMANS ) {
if( level.humanTeamLocked )
{
- ADMP( "^3!lock: ^7Human team is already locked\n" );
+ ADMP( "^3!lock: ^7the human team is already locked\n" );
return qfalse;
}
else
level.humanTeamLocked = qtrue;
}
+ else
+ {
+ ADMP( va( "^3!lock: ^7invalid team\"%c\"\n", teamName[0] ) );
+ return qfalse;
+ }
- AP( va( "print \"^3!lock: ^7%s team has been locked by %s\n\"",
- ( team == TEAM_ALIENS ) ? "Alien" : "Human",
+ AP( va( "print \"^3!lock: ^7the %s team has been locked by %s\n\"",
+ G_TeamName( team ),
( ent ) ? ent->client->pers.netname : "console" ) );
return qtrue;
}
@@ -2953,21 +2948,13 @@ qboolean G_admin_unlock( gentity_t *ent, int skiparg )
return qfalse;
}
G_SayArgv( 1 + skiparg, teamName, sizeof( teamName ) );
- if( teamName[ 0 ] == 'a' || teamName[ 0 ] == 'A' )
- team = TEAM_ALIENS;
- else if( teamName[ 0 ] == 'h' || teamName[ 0 ] == 'H' )
- team = TEAM_HUMANS;
- else
- {
- ADMP( va( "^3!unlock: ^7invalid team\"%c\"\n", teamName[0] ) );
- return qfalse;
- }
+ team = G_TeamFromString( teamName );
if( team == TEAM_ALIENS )
{
if( !level.alienTeamLocked )
{
- ADMP( "^3!unlock: ^7Alien team is not currently locked\n" );
+ ADMP( "^3!unlock: ^7the alien team is not currently locked\n" );
return qfalse;
}
else
@@ -2976,15 +2963,20 @@ qboolean G_admin_unlock( gentity_t *ent, int skiparg )
else if( team == TEAM_HUMANS ) {
if( !level.humanTeamLocked )
{
- ADMP( "^3!unlock: ^7Human team is not currently locked\n" );
+ ADMP( "^3!unlock: ^7the human team is not currently locked\n" );
return qfalse;
}
else
level.humanTeamLocked = qfalse;
}
+ else
+ {
+ ADMP( va( "^3!unlock: ^7invalid team\"%c\"\n", teamName[0] ) );
+ return qfalse;
+ }
- AP( va( "print \"^3!unlock: ^7%s team has been unlocked by %s\n\"",
- ( team == TEAM_ALIENS ) ? "Alien" : "Human",
+ AP( va( "print \"^3!unlock: ^7the %s team has been unlocked by %s\n\"",
+ G_TeamName( team ),
( ent ) ? ent->client->pers.netname : "console" ) );
return qtrue;
}
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index e9434056..8a987a2d 100644
--- a/src/game/g_buildable.c
+++ b/src/game/g_buildable.c
@@ -3755,9 +3755,7 @@ void G_BaseSelfDestruct( team_t team )
continue;
if( ent->s.eType != ET_BUILDABLE )
continue;
- if( team == TEAM_HUMANS && ent->buildableTeam != TEAM_HUMANS )
- continue;
- if( team == TEAM_ALIENS && ent->buildableTeam != TEAM_ALIENS )
+ if( ent->buildableTeam != team )
continue;
G_Damage( ent, NULL, NULL, NULL, NULL, 10000, 0, MOD_SUICIDE );
}
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index c3a0af65..49fc49f7 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -531,117 +531,18 @@ void Cmd_Kill_f( gentity_t *ent )
}
/*
-==================
-G_LeaveTeam
-==================
-*/
-void G_LeaveTeam( gentity_t *self )
-{
- team_t team = self->client->pers.teamSelection;
- gentity_t *ent;
- int i;
-
- if( team == TEAM_ALIENS )
- G_RemoveFromSpawnQueue( &level.alienSpawnQueue, self->client->ps.clientNum );
- else if( team == TEAM_HUMANS )
- G_RemoveFromSpawnQueue( &level.humanSpawnQueue, self->client->ps.clientNum );
- else
- {
- // might have been following somone so reset
- if( self->client->sess.spectatorState == SPECTATOR_FOLLOW )
- G_StopFollowing( self );
- return;
- }
-
- // stop any following clients
- G_StopFromFollowing( self );
-
- G_TeamVote( self, qfalse );
- self->suicideTime = 0;
-
- for( i = 0; i < level.num_entities; i++ )
- {
- ent = &g_entities[ i ];
- if( !ent->inuse )
- continue;
-
- if( ent->client && ent->client->pers.connected == CON_CONNECTED )
- {
- // cure poison
- if( ent->client->ps.stats[ STAT_STATE ] & SS_POISONED &&
- ent->client->lastPoisonClient == self )
- ent->client->ps.stats[ STAT_STATE ] &= ~SS_POISONED;
- }
- else if( ent->s.eType == ET_MISSILE && ent->r.ownerNum == self->s.number )
- G_FreeEntity( ent );
- }
-}
-
-/*
-=================
-G_ChangeTeam
-=================
-*/
-void G_ChangeTeam( gentity_t *ent, team_t newTeam )
-{
- team_t oldTeam = ent->client->pers.teamSelection;
-
- if( oldTeam == newTeam )
- return;
-
- G_LeaveTeam( ent );
- ent->client->pers.teamSelection = newTeam;
- ent->client->pers.classSelection = PCL_NONE;
- ClientSpawn( ent, NULL, NULL, NULL );
- ent->client->pers.joinedATeam = qtrue;
- ent->client->pers.teamChangeTime = level.time;
-
- if( oldTeam == TEAM_NONE )
- {
- // ps.persistant[] from a spectator cannot be trusted
- ent->client->ps.persistant[ PERS_CREDIT ] = ent->client->pers.savedCredit;
- }
- else if( oldTeam == TEAM_HUMANS && newTeam == TEAM_ALIENS )
- {
- // Convert from human to alien credits
- ent->client->ps.persistant[ PERS_CREDIT ] =
- (int)( ent->client->ps.persistant[ PERS_CREDIT ] *
- ALIEN_MAX_CREDITS / HUMAN_MAX_CREDITS + 0.5f );
- }
- else if( oldTeam == TEAM_ALIENS && newTeam == TEAM_HUMANS )
- {
- // Convert from alien to human credits
- ent->client->ps.persistant[ PERS_CREDIT ] =
- (int)( ent->client->ps.persistant[ PERS_CREDIT ] *
- HUMAN_MAX_CREDITS / ALIEN_MAX_CREDITS + 0.5f );
- }
-
- ent->client->pers.credit = ent->client->ps.persistant[ PERS_CREDIT ];
-
- if( newTeam == TEAM_NONE )
- {
- // save values before the client enters the spectator team and their
- // ps.persistant[] values become trashed
- ent->client->pers.savedCredit = ent->client->ps.persistant[ PERS_CREDIT ];
- }
-
- ClientUserinfoChanged( ent->client->ps.clientNum );
-}
-
-/*
=================
Cmd_Team_f
=================
*/
void Cmd_Team_f( gentity_t *ent )
{
- team_t team;
- team_t oldteam = ent->client->pers.teamSelection;
- char s[ MAX_TOKEN_CHARS ];
- qboolean force = G_admin_permission(ent, ADMF_FORCETEAMCHANGE);
- int aliens = level.numAlienClients;
- int humans = level.numHumanClients;
- char *teamname, *oldteamname;
+ team_t team;
+ team_t oldteam = ent->client->pers.teamSelection;
+ char s[ MAX_TOKEN_CHARS ];
+ qboolean force = G_admin_permission(ent, ADMF_FORCETEAMCHANGE);
+ int aliens = level.numAlienClients;
+ int humans = level.numHumanClients;
gentity_t *tempent;
// stop team join spam
@@ -649,17 +550,9 @@ void Cmd_Team_f( gentity_t *ent )
return;
if( oldteam == TEAM_ALIENS )
- {
aliens--;
- oldteamname = "aliens";
- }
else if( oldteam == TEAM_HUMANS )
- {
humans--;
- oldteamname = "humans";
- }
- else
- oldteamname = "spectators";
trap_Argv( 1, s, sizeof( s ) );
@@ -670,82 +563,66 @@ void Cmd_Team_f( gentity_t *ent )
return;
}
- if( !Q_stricmpn( s, "spec", 4 ) )
- team = TEAM_NONE;
- else if( !force && oldteam == TEAM_NONE && g_maxGameClients.integer &&
- level.numPlayingClients >= g_maxGameClients.integer )
- {
- trap_SendServerCommand( ent-g_entities, va( "print \"The maximum number of "
- "playing clients has been reached (g_maxGameClients = %d)\n\"",
- g_maxGameClients.integer ) );
- return;
- }
- else if( !Q_stricmpn( s, "alien", 5 ) )
- {
- if( level.alienTeamLocked )
- {
- trap_SendServerCommand( ent-g_entities,
- "print \"Alien team has been ^1LOCKED\n\"" );
- return;
- }
- else if( level.humanTeamLocked )
- {
- // if only one team has been locked, let people join the other
- // regardless of balance
- force = qtrue;
- }
-
- if( !force && g_teamForceBalance.integer && aliens > humans )
- {
- G_TriggerMenu( ent - g_entities, MN_A_TEAMFULL );
- return;
- }
-
- team = TEAM_ALIENS;
- }
- else if( !Q_stricmpn( s, "human", 5 ) )
- {
- if( level.humanTeamLocked )
- {
- trap_SendServerCommand( ent-g_entities,
- "print \"Human team has been ^1LOCKED\n\"" );
- return;
- }
- else if( level.alienTeamLocked )
- {
- // if only one team has been locked, let people join the other
- // regardless of balance
- force = qtrue;
- }
-
- if( !force && g_teamForceBalance.integer && humans > aliens )
- {
- G_TriggerMenu( ent - g_entities, MN_H_TEAMFULL );
- return;
- }
-
- team = TEAM_HUMANS;
- }
- else if( !Q_stricmp( s, "auto" ) )
+ if( !Q_stricmp( s, "auto" ) )
{
if( level.humanTeamLocked && level.alienTeamLocked )
team = TEAM_NONE;
- else if( humans > aliens )
+ else if( level.humanTeamLocked || humans > aliens )
team = TEAM_ALIENS;
- else if( humans < aliens )
+
+ else if( level.alienTeamLocked || aliens > humans )
team = TEAM_HUMANS;
else
team = TEAM_ALIENS + ( rand( ) % 2 );
-
- if( team == TEAM_ALIENS && level.alienTeamLocked )
- team = TEAM_HUMANS;
- else if( team == TEAM_HUMANS && level.humanTeamLocked )
- team = TEAM_ALIENS;
}
- else
+ else switch( G_TeamFromString( s ) )
{
- trap_SendServerCommand( ent-g_entities, va( "print \"Unknown team: %s\n\"", s ) );
- return;
+ case TEAM_NONE:
+ team = TEAM_NONE;
+ break;
+
+ case TEAM_ALIENS:
+ if( level.alienTeamLocked )
+ {
+ trap_SendServerCommand( ent-g_entities,
+ "print \"Alien team has been ^1LOCKED\n\"" );
+ return;
+ }
+ else if( level.humanTeamLocked )
+ force = qtrue;
+
+ if( !force && g_teamForceBalance.integer && aliens > humans )
+ {
+ G_TriggerMenu( ent - g_entities, MN_A_TEAMFULL );
+ return;
+ }
+
+ team = TEAM_ALIENS;
+ break;
+
+ case TEAM_HUMANS:
+ if( level.humanTeamLocked )
+ {
+ trap_SendServerCommand( ent-g_entities,
+ "print \"Human team has been ^1LOCKED\n\"" );
+ return;
+ }
+ else if( level.alienTeamLocked )
+ force = qtrue;
+
+ if( !force && g_teamForceBalance.integer && humans > aliens )
+ {
+ G_TriggerMenu( ent - g_entities, MN_H_TEAMFULL );
+ return;
+ }
+
+ team = TEAM_HUMANS;
+ break;
+
+ default:
+ trap_SendServerCommand( ent-g_entities,
+ va( "print \"Unknown team: %s\n\"", s ) );
+ return;
}
// stop team join spam
@@ -774,21 +651,7 @@ void Cmd_Team_f( gentity_t *ent )
tempent->s.eventParm = ent->s.number;
tempent->s.otherEntityNum = team;
tempent->s.otherEntityNum2 = oldteam;
- tempent->r.svFlags = SVF_BROADCAST;
-
- if( team == TEAM_ALIENS )
- teamname = "aliens";
- else if( team == TEAM_HUMANS )
- teamname = "humans";
- else
- teamname = "spectators";
-
- if( oldteam != TEAM_NONE && team != TEAM_NONE )
- G_LogPrintf( "team: %i %i %i: %s" S_COLOR_WHITE " left the %s and joined the %s\n", ent->s.number, team, oldteam, ent->client->pers.netname, oldteamname, teamname );
- else if( team == TEAM_NONE )
- G_LogPrintf( "team: %i %i %i: %s" S_COLOR_WHITE " left the %s\n", ent->s.number, team, oldteam, ent->client->pers.netname, oldteamname );
- else
- G_LogPrintf( "team: %i %i %i: %s" S_COLOR_WHITE " joined the %s\n", ent->s.number, team, oldteam, ent->client->pers.netname, teamname );
+ tempent->r.svFlags = SVF_BROADCAST;
}
@@ -848,20 +711,8 @@ void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chatText )
if( g_chatTeamPrefix.integer )
{
- switch( ent->client->pers.teamSelection )
- {
- default:
- case TEAM_NONE:
- prefix = "[S] ";
- break;
-
- case TEAM_ALIENS:
- prefix = "[A] ";
- break;
-
- case TEAM_HUMANS:
- prefix = "[H] ";
- }
+ prefix = G_TeamName( ent->client->pers.teamSelection );
+ prefix = va( "[%c] ", toupper( *prefix ) );
}
else
prefix = "";
diff --git a/src/game/g_local.h b/src/game/g_local.h
index 8306b8cc..648774c1 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -673,8 +673,6 @@ int G_SayArgc( void );
qboolean G_SayArgv( int n, char *buffer, int bufferLength );
char *G_SayConcatArgs( int start );
void G_DecolorString( char *in, char *out, int len );
-void G_LeaveTeam( gentity_t *self );
-void G_ChangeTeam( gentity_t *ent, team_t newTeam );
void G_SanitiseString( char *in, char *out, int len );
void G_PrivateMessage( gentity_t *ent );
void Cmd_Test_f( gentity_t *ent );
@@ -961,7 +959,11 @@ void G_RunClient( gentity_t *ent );
//
// g_team.c
//
+team_t G_TeamFromString( char *str );
+char *G_TeamName( team_t team );
qboolean OnSameTeam( gentity_t *ent1, gentity_t *ent2 );
+void G_LeaveTeam( gentity_t *self );
+void G_ChangeTeam( gentity_t *ent, team_t newTeam );
gentity_t *Team_GetLocation( gentity_t *ent );
qboolean Team_GetLocationMsg( gentity_t *ent, char *loc, int loclen );
void TeamplayInfoMessage( gentity_t *ent );
diff --git a/src/game/g_team.c b/src/game/g_team.c
index 7ec6855c..e57da1bd 100644
--- a/src/game/g_team.c
+++ b/src/game/g_team.c
@@ -44,6 +44,43 @@ void QDECL PrintMsg( gentity_t *ent, const char *fmt, ... )
trap_SendServerCommand( ( ( ent == NULL ) ? -1 : ent-g_entities ), va( "print \"%s\"", msg ) );
}
+/*
+================
+G_TeamFromString
+
+Return the team referenced by a string
+================
+*/
+team_t G_TeamFromString( char *str )
+{
+ switch( tolower( *str ) )
+ {
+ case '0': case 's': return TEAM_NONE;
+ case '1': case 'a': return TEAM_ALIENS;
+ case '2': case 'h': return TEAM_HUMANS;
+ default: return NUM_TEAMS;
+ }
+}
+
+/*
+================
+G_TeamName
+================
+*/
+char *G_TeamName( team_t team )
+{
+ switch( team )
+ {
+ case TEAM_NONE:
+ return "spectator";
+ case TEAM_ALIENS:
+ return "alien";
+ case TEAM_HUMANS:
+ return "human";
+ default:
+ return "unknown";
+ }
+}
/*
==============
@@ -62,6 +99,104 @@ qboolean OnSameTeam( gentity_t *ent1, gentity_t *ent2 )
}
/*
+==================
+G_LeaveTeam
+==================
+*/
+void G_LeaveTeam( gentity_t *self )
+{
+ team_t team = self->client->pers.teamSelection;
+ gentity_t *ent;
+ int i;
+
+ if( team == TEAM_ALIENS )
+ G_RemoveFromSpawnQueue( &level.alienSpawnQueue, self->client->ps.clientNum );
+ else if( team == TEAM_HUMANS )
+ G_RemoveFromSpawnQueue( &level.humanSpawnQueue, self->client->ps.clientNum );
+ else
+ {
+ // might have been following somone so reset
+ if( self->client->sess.spectatorState == SPECTATOR_FOLLOW )
+ G_StopFollowing( self );
+ return;
+ }
+
+ // stop any following clients
+ G_StopFromFollowing( self );
+
+ G_TeamVote( self, qfalse );
+ self->suicideTime = 0;
+
+ for( i = 0; i < level.num_entities; i++ )
+ {
+ ent = &g_entities[ i ];
+ if( !ent->inuse )
+ continue;
+
+ if( ent->client && ent->client->pers.connected == CON_CONNECTED )
+ {
+ // cure poison
+ if( ent->client->ps.stats[ STAT_STATE ] & SS_POISONED &&
+ ent->client->lastPoisonClient == self )
+ ent->client->ps.stats[ STAT_STATE ] &= ~SS_POISONED;
+ }
+ else if( ent->s.eType == ET_MISSILE && ent->r.ownerNum == self->s.number )
+ G_FreeEntity( ent );
+ }
+}
+
+/*
+=================
+G_ChangeTeam
+=================
+*/
+void G_ChangeTeam( gentity_t *ent, team_t newTeam )
+{
+ team_t oldTeam = ent->client->pers.teamSelection;
+
+ if( oldTeam == newTeam )
+ return;
+
+ G_LeaveTeam( ent );
+ ent->client->pers.teamSelection = newTeam;
+ ent->client->pers.classSelection = PCL_NONE;
+ ClientSpawn( ent, NULL, NULL, NULL );
+ ent->client->pers.joinedATeam = qtrue;
+ ent->client->pers.teamChangeTime = level.time;
+
+ if( oldTeam == TEAM_NONE )
+ {
+ // ps.persistant[] from a spectator cannot be trusted
+ ent->client->ps.persistant[ PERS_CREDIT ] = ent->client->pers.savedCredit;
+ }
+ else if( oldTeam == TEAM_HUMANS && newTeam == TEAM_ALIENS )
+ {
+ // Convert from human to alien credits
+ ent->client->ps.persistant[ PERS_CREDIT ] =
+ (int)( ent->client->ps.persistant[ PERS_CREDIT ] *
+ ALIEN_MAX_CREDITS / HUMAN_MAX_CREDITS + 0.5f );
+ }
+ else if( oldTeam == TEAM_ALIENS && newTeam == TEAM_HUMANS )
+ {
+ // Convert from alien to human credits
+ ent->client->ps.persistant[ PERS_CREDIT ] =
+ (int)( ent->client->ps.persistant[ PERS_CREDIT ] *
+ HUMAN_MAX_CREDITS / ALIEN_MAX_CREDITS + 0.5f );
+ }
+
+ ent->client->pers.credit = ent->client->ps.persistant[ PERS_CREDIT ];
+
+ if( newTeam == TEAM_NONE )
+ {
+ // save values before the client enters the spectator team and their
+ // ps.persistant[] values become trashed
+ ent->client->pers.savedCredit = ent->client->ps.persistant[ PERS_CREDIT ];
+ }
+
+ ClientUserinfoChanged( ent->client->ps.clientNum );
+}
+
+/*
===========
Team_GetLocation