diff options
author | Roman Tetelman <kevlarman@gmail.com> | 2009-10-03 13:07:38 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:16:29 +0000 |
commit | 8230fd582a135ac6d83cea335895657c283f923c (patch) | |
tree | bf8a6365a1c554253e6ba8699669bbb4d66fecc4 /src/game/g_active.c | |
parent | 993c2651e6ad67a052927afa859a4837f4238737 (diff) |
Fix camper credits
* The time clients are alive is recorded in seconds.
* Award free funds regardless of death. Funds will be given
- when the client is alive every g_freeFundPeriod if
g_freeFundPeriod is positive (otherwise no free funds are
given).
Diffstat (limited to 'src/game/g_active.c')
-rw-r--r-- | src/game/g_active.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/src/game/g_active.c b/src/game/g_active.c index 097370d2..318ed915 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -741,6 +741,20 @@ void ClientTimerActions( gentity_t *ent, int msec ) client->voiceEnthusiasm -= VOICE_ENTHUSIASM_DECAY; else client->voiceEnthusiasm = 0.0f; + + client->pers.aliveSeconds++; + if( g_freeFundPeriod.integer > 0 && + client->pers.aliveSeconds % g_freeFundPeriod.integer == 0 ) + { + // Give clients some credit periodically + if( G_TimeTilSuddenDeath( ) > 0 ) + { + if( client->ps.stats[ STAT_TEAM ] == TEAM_ALIENS ) + G_AddCreditToClient( client, FREEKILL_ALIEN, qtrue ); + else if( client->ps.stats[ STAT_TEAM ] == TEAM_HUMANS ) + G_AddCreditToClient( client, FREEKILL_HUMAN, qtrue ); + } + } } while( client->time10000 >= 10000 ) @@ -1748,21 +1762,6 @@ void ClientThink_real( gentity_t *ent ) if( client->ps.persistant[ PERS_BP ] < 0 ) client->ps.persistant[ PERS_BP ] = 0; - // Give clients some credit periodically - if( ent->client->lastKillTime + g_freeKillPeriod.integer < level.time ) - { - if( G_TimeTilSuddenDeath( ) <= 0 ) - { - //gotta love logic like this eh? - } - else if( ent->client->ps.stats[ STAT_TEAM ] == TEAM_ALIENS ) - G_AddCreditToClient( ent->client, FREEKILL_ALIEN, qtrue ); - else if( ent->client->ps.stats[ STAT_TEAM ] == TEAM_HUMANS ) - G_AddCreditToClient( ent->client, FREEKILL_HUMAN, qtrue ); - - ent->client->lastKillTime = level.time; - } - // perform once-a-second actions ClientTimerActions( ent, msec ); |