summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorJohn Ellis <johne@verizon.net>2010-11-28 22:29:15 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:17:43 +0000
commit38b856f74c691f52182d13831810741cb7e9598f (patch)
treeeadafe6d6b2176976f6f771b9bce13979aa1f7eb /src/game
parented215fc83af4fd3bee50a3fe5b4f252ee02284bb (diff)
* Fix tallying of credits earned for staging when a player dies.
Diffstat (limited to 'src/game')
-rw-r--r--src/game/g_combat.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/game/g_combat.c b/src/game/g_combat.c
index 5f93de5d..62045177 100644
--- a/src/game/g_combat.c
+++ b/src/game/g_combat.c
@@ -139,6 +139,7 @@ float G_RewardAttackers( gentity_t *self )
{
float value, totalDamage = 0;
int team, i, maxHealth = 0;
+ int alienCredits = 0, humanCredits = 0;
gentity_t *player;
// Total up all the damage done by non-teammates
@@ -201,15 +202,26 @@ float G_RewardAttackers( gentity_t *self )
// add to stage counters
if( player->client->ps.stats[ STAT_TEAM ] == TEAM_ALIENS )
- trap_Cvar_Set( "g_alienCredits",
- va( "%d", g_alienCredits.integer + stageValue ) );
+ alienCredits += stageValue;
else if( player->client->ps.stats[ STAT_TEAM ] == TEAM_HUMANS )
- trap_Cvar_Set( "g_humanCredits",
- va( "%d", g_humanCredits.integer + stageValue ) );
+ humanCredits += stageValue;
}
}
self->credits[ i ] = 0;
}
+
+ if( alienCredits )
+ {
+ trap_Cvar_Set( "g_alienCredits",
+ va( "%d", g_alienCredits.integer + alienCredits ) );
+ trap_Cvar_Update( &g_alienCredits );
+ }
+ if( humanCredits )
+ {
+ trap_Cvar_Set( "g_humanCredits",
+ va( "%d", g_humanCredits.integer + humanCredits ) );
+ trap_Cvar_Update( &g_humanCredits );
+ }
return totalDamage;
}