summaryrefslogtreecommitdiff
path: root/src/game/g_cmds.c
diff options
context:
space:
mode:
authorMichael Levin <risujin@fastmail.fm>2009-10-03 11:18:41 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:14:52 +0000
commit9dd501f6338a95183ad4a245c2b813699b3a6513 (patch)
tree04c90a6abb944f960f809613160f481bc99d5a3d /src/game/g_cmds.c
parentd1747093e36873d29801ff6c6ecf5d24db94be62 (diff)
* Oops, Repeater now gives Repeater reward credits
* Reloading a weapon and switching to blaster will not cause it to be "reloaded" * Removed "team change free" flag, all clients keep credits when changing teams * Human and Alien credits properly converted when switching teams (based on max) * Cannot open both say prompts at the same time anymore
Diffstat (limited to 'src/game/g_cmds.c')
-rw-r--r--src/game/g_cmds.c34
1 files changed, 11 insertions, 23 deletions
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index 6b2e94c2..11dd7973 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -355,7 +355,7 @@ void Cmd_Give_f( gentity_t *ent )
if( give_all || Q_stricmpn( name, "funds", 5 ) == 0 )
{
- int credits = give_all ? HUMAN_MAX_CREDITS : atoi( name + 6 );
+ int credits = give_all ? ALIEN_MAX_CREDITS : atoi( name + 6 );
G_AddCreditToClient( ent->client, credits, qtrue );
}
@@ -565,38 +565,26 @@ G_ChangeTeam
void G_ChangeTeam( gentity_t *ent, pTeam_t newTeam )
{
pTeam_t oldTeam = ent->client->pers.teamSelection;
-
+
if( oldTeam == newTeam )
return;
G_LeaveTeam( ent );
ent->client->pers.teamSelection = newTeam;
-
- // under certain circumstances, clients can keep their kills and credits
- // when switching teams
- if( G_admin_permission( ent, ADMF_TEAMCHANGEFREE ) ||
- ( ( oldTeam == PTE_HUMANS || oldTeam == PTE_ALIENS )
- && ( level.time - ent->client->pers.teamChangeTime ) > 60000 ) )
- {
- if( oldTeam == PTE_ALIENS )
- ent->client->pers.credit *= (float)FREEKILL_HUMAN / FREEKILL_ALIEN;
- else if( newTeam == PTE_ALIENS )
- ent->client->pers.credit *= (float)FREEKILL_ALIEN / FREEKILL_HUMAN;
- }
- else
- {
- ent->client->pers.credit = 0;
- ent->client->pers.score = 0;
- }
-
ent->client->pers.classSelection = PCL_NONE;
ClientSpawn( ent, NULL, NULL, NULL );
-
ent->client->pers.joinedATeam = qtrue;
ent->client->pers.teamChangeTime = level.time;
-
- //update ClientInfo
ClientUserinfoChanged( ent->client->ps.clientNum );
+
+ // Convert between Alien and Human credits, specs use Alien credits
+ if( oldTeam == PTE_HUMANS )
+ ent->client->pers.credit = (int)( ent->client->pers.credit *
+ ALIEN_MAX_CREDITS / HUMAN_MAX_CREDITS + 0.5f );
+ if( newTeam == PTE_HUMANS )
+ ent->client->pers.credit = (int)( ent->client->ps.persistant[ PERS_CREDIT ] *
+ HUMAN_MAX_CREDITS / ALIEN_MAX_CREDITS + 0.5f );
+ ent->client->ps.persistant[ PERS_CREDIT ] = ent->client->pers.credit;
}
/*