From b4f7bd74f46219909dcb116d4448a378edc405b7 Mon Sep 17 00:00:00 2001 From: Theriaca Date: Sat, 26 Jan 2019 07:19:44 +0100 Subject: 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' --- src/game/g_combat.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/game/g_combat.c') 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; -- cgit