summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/g_client.c44
1 files changed, 19 insertions, 25 deletions
diff --git a/src/game/g_client.c b/src/game/g_client.c
index 0eafac0..b8b4968 100644
--- a/src/game/g_client.c
+++ b/src/game/g_client.c
@@ -149,36 +149,30 @@ G_AddFundsToClient
*/
void G_AddFundsToClient(gclient_t *client, float funds, qboolean cap)
{
- if (!client || funds == 0)
- return;
-
- if (cap) {
- float max = 0.0f;
- float buffer = funds;
+ if (!client)
+ return;
- if (client->pers.teamSelection == PTE_ALIENS)
- max = ALIEN_MAX_KILLS;
- else if (client->pers.teamSelection == PTE_HUMANS)
- max = HUMAN_MAX_CREDITS;
+ client->pers.funds += funds;
+ if (client->pers.funds < 0)
+ client->pers.funds = 0;
- buffer = client->pers.funds + funds - max;
+ if (cap) {
+ float max;
- if (buffer > 0) {
- G_OverflowFunds(client, buffer);
- client->pers.funds = max;
- } else {
- client->pers.funds += funds;
- }
- } else {
- client->pers.funds += funds;
- }
+ if (client->pers.teamSelection == PTE_ALIENS)
+ max = ALIEN_MAX_KILLS;
+ else
+ max = HUMAN_MAX_CREDITS;
- if (client->pers.funds < 0)
- client->pers.funds = 0;
+ if (client->pers.funds > max) {
+ G_OverflowFunds(client, client->pers.funds - max);
+ client->pers.funds = max;
+ }
+ }
- // keep PERS_CREDIT in sync if not following
- if (client->sess.spectatorState != SPECTATOR_FOLLOW)
- client->ps.persistant[PERS_CREDIT] = floorf(client->pers.funds);
+ // keep PERS_CREDIT in sync if not following
+ if (client->sess.spectatorState != SPECTATOR_FOLLOW)
+ client->ps.persistant[PERS_CREDIT] = floorf(client->pers.funds);
}