summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Ellis <johne@verizon.net>2010-07-20 22:11:01 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:17:39 +0000
commit54eb97fb4454da6c26ff3fc935760ff392fde3a4 (patch)
treebee26027e7834d2f3633ac73ae27da1c51b5a425 /src
parentd78c890af21b6ae298174db5991b9efec2e4b688 (diff)
* Fix losing credits when player is already over the cap by selling equipment.
Diffstat (limited to 'src')
-rw-r--r--src/game/g_client.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/game/g_client.c b/src/game/g_client.c
index c3afede2..bb5ff908 100644
--- a/src/game/g_client.c
+++ b/src/game/g_client.c
@@ -91,12 +91,19 @@ void G_AddCreditToClient( gclient_t *client, short credit, qboolean cap )
if( !client )
return;
- client->pers.credit += credit;
- capAmount = client->pers.teamSelection == TEAM_ALIENS ?
- ALIEN_MAX_CREDITS : HUMAN_MAX_CREDITS;
-
- if( cap && client->pers.credit > capAmount )
- client->pers.credit = capAmount;
+ if( cap && credit > 0 )
+ {
+ capAmount = client->pers.teamSelection == TEAM_ALIENS ?
+ ALIEN_MAX_CREDITS : HUMAN_MAX_CREDITS;
+ if( client->pers.credit < capAmount )
+ {
+ client->pers.credit += credit;
+ if( client->pers.credit > capAmount )
+ client->pers.credit = capAmount;
+ }
+ }
+ else
+ client->pers.credit += credit;
if( client->pers.credit < 0 )
client->pers.credit = 0;