diff options
author | Theriaca <reichmeister@protonmail.com> | 2019-01-26 07:19:44 +0100 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2019-02-10 14:47:47 +0100 |
commit | b4f7bd74f46219909dcb116d4448a378edc405b7 (patch) | |
tree | 24a354b1d42671cb0d64214f367ab387d05a20d8 /src/game/g_combat.c | |
parent | f70201598451e80e635c28a4eca198092211e399 (diff) |
rewrite and optimize G_OverflowCredits()
- now always prioritizes poor players
- synchronizes PERS_CREDIT once per loop, instead of constantly
additionally, rename:
- G_AddCreditToClient -> G_AddFundsToClient
- G_OverflowCredits -> G_OverflowFunds
- 'credit(s)' parameters -> 'funds'
Diffstat (limited to 'src/game/g_combat.c')
-rw-r--r-- | src/game/g_combat.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/game/g_combat.c b/src/game/g_combat.c index 7b58f1f..d834fcd 100644 --- a/src/game/g_combat.c +++ b/src/game/g_combat.c @@ -279,9 +279,9 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int if( !g_retribution.integer ) { if( attacker->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS ) - G_AddCreditToClient( attacker->client, -FREEKILL_ALIEN, qtrue ); + G_AddFundsToClient( attacker->client, -FREEKILL_ALIEN, qtrue ); else if( attacker->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) - G_AddCreditToClient( attacker->client, -FREEKILL_HUMAN, qtrue ); + G_AddFundsToClient( attacker->client, -FREEKILL_HUMAN, qtrue ); } } else @@ -386,8 +386,8 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int price = g_entities[ i ].client->ps.persistant[ PERS_CREDIT ]; if ( price ) { - G_AddCreditToClient( self->client, price, qtrue ); - G_AddCreditToClient( g_entities[ i ].client, -price, qtrue ); + G_AddFundsToClient( self->client, price, qtrue ); + G_AddFundsToClient( g_entities[ i ].client, -price, qtrue ); trap_SendServerCommand( self->client->ps.clientNum, va( "print \"Received ^3%d credits ^7from %s ^7in retribution.\n\"", @@ -447,8 +447,8 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int if ( !toPay[ i ] ) continue; - G_AddCreditToClient( self->client, toPay[ i ], qtrue ); - G_AddCreditToClient( g_entities[ i ].client, -toPay[ i ], qtrue ); + G_AddFundsToClient( self->client, toPay[ i ], qtrue ); + G_AddFundsToClient( g_entities[ i ].client, -toPay[ i ], qtrue ); trap_SendServerCommand( self->client->ps.clientNum, va( "print \"Received ^3%d ^7evos from %s ^7in retribution.\n\"", @@ -533,7 +533,7 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int percentDamage *= (float)spreeRate; //add credit - G_AddCreditToClient( player->client, + G_AddFundsToClient( player->client, (int)( classValue * percentDamage ), qtrue ); } } @@ -572,9 +572,9 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int { //add kills if( spreeRate && player == attacker ) - G_AddCreditToClient( player->client, frags * spreeRate, qtrue ); + G_AddFundsToClient( player->client, frags * spreeRate, qtrue ); else - G_AddCreditToClient( player->client, frags, qtrue ); + G_AddFundsToClient( player->client, frags, qtrue ); //can't revist this account later self->credits[ i ] = 0; |