diff options
author | Tim Angus <tim@ngus.net> | 2005-01-19 21:07:23 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2005-01-19 21:07:23 +0000 |
commit | 6c5ac136f3515c068c5258da49c8d1cc1121a66c (patch) | |
tree | 77cb5d52a90876082f083964dd08481df0134944 /src | |
parent | 795407be82d8a2eecf590a76fb41671791799271 (diff) |
* Fixed silly integer division bug
Diffstat (limited to 'src')
-rw-r--r-- | src/game/g_combat.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/game/g_combat.c b/src/game/g_combat.c index f423e063..3b42fd86 100644 --- a/src/game/g_combat.c +++ b/src/game/g_combat.c @@ -243,12 +243,12 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int if( attacker && attacker->client ) { int clientNum = attacker->client->ps.clientNum; - int totalDamage = 0; + float totalDamage = 0.0f; gentity_t *player; //total up all the damage done by every client for( i = 0; i < MAX_CLIENTS; i++ ) - totalDamage += self->credits[ i ]; + totalDamage += (float)self->credits[ i ]; if( totalDamage > 0.0f ) { @@ -272,7 +272,7 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int //add credit G_AddCreditToClient( player->client, - (int)( classValue * ( self->credits[ i ] / totalDamage ) ) ); + (int)( classValue * ( (float)self->credits[ i ] / totalDamage ) ) ); } } else if( self->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) @@ -300,7 +300,7 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int if( !unclaimedFrags ) break; - frags = (int)floor( humanValue * ( self->credits[ i ] / totalDamage ) ); + frags = (int)floor( humanValue * ( (float)self->credits[ i ] / totalDamage ) ); if( frags > 0 ) { |