summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorChristopher Schwarz <lakitu7@gmail.com>2011-02-21 09:20:14 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:18:01 +0000
commit2200a515b61e26e72a3f2a798f2c2ec9df4b21ff (patch)
tree13faa5c42e94e797a61e8637690251035e9634ae /src/game
parentcf1f5dc37a767c2ebe3c88fc106a23e5cc13b15a (diff)
* Mess with /give funds again to try to finally make everyone happy with how this incredibly unimportant function is implemented
Diffstat (limited to 'src/game')
-rw-r--r--src/game/g_cmds.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index 54bd2e97..4f5e986e 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -412,10 +412,10 @@ void Cmd_Give_f( gentity_t *ent )
if( give_all || Q_stricmpn( name, "funds", 5 ) == 0 )
{
- int credits;
+ float credits;
if( give_all || trap_Argc( ) < 3 )
- credits = 30000;
+ credits = 30000.0f;
else
{
credits = atof( name + 6 ) *
@@ -423,12 +423,10 @@ void Cmd_Give_f( gentity_t *ent )
TEAM_ALIENS ? ALIEN_CREDITS_PER_KILL : 1.0f );
// clamp credits manually, as G_AddCreditToClient() expects a short int
- if( credits > 30000 )
- credits = 30000;
- else if( name[ 6 ] == '-' && credits < -30000 )
- credits = -30000;
- else if( credits < -30000 ) // overflowed int; didn't want negative
- credits = 30000;
+ if( credits > SHRT_MAX )
+ credits = 30000.0f;
+ else if( credits < SHRT_MIN )
+ credits = -30000.0f;
}
G_AddCreditToClient( ent->client, (short)credits, qtrue );