summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-08-02 21:14:38 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-08-02 21:14:38 +0000
commitac0261e807d352714ddf77be4351c037e0ed98a0 (patch)
treeb7e29eeef47d4b16754eb5f2e4f42cdadc9c8751 /src/map/pc.c
parentd2dad92cd1c4f7cb560c5920421760be901cc9f7 (diff)
downloadhercules-ac0261e807d352714ddf77be4351c037e0ed98a0.tar.gz
hercules-ac0261e807d352714ddf77be4351c037e0ed98a0.tar.bz2
hercules-ac0261e807d352714ddf77be4351c037e0ed98a0.tar.xz
hercules-ac0261e807d352714ddf77be4351c037e0ed98a0.zip
- Rewrote pc_payzeny to not use doubles, it may more accurately prevent charging a player more zeny than they can withhold.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8072 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index b312c796f..674b63973 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -2516,16 +2516,17 @@ int pc_inventoryblank(struct map_session_data *sd)
*/
int pc_payzeny(struct map_session_data *sd,int zeny)
{
- double z;
-
nullpo_retr(0, sd);
if(sd->state.finalsave)
return 1;
- z = (double)sd->status.zeny;
- if(sd->status.zeny<zeny || z - (double)zeny > MAX_ZENY)
- return 1;
+ if (zeny > 0 && sd->status.zeny < zeny)
+ return 1; //Not enough.
+
+ if (zeny < 0 && sd->status.zeny > MAX_ZENY +zeny)
+ return 1; //Overflow
+
sd->status.zeny-=zeny;
clif_updatestatus(sd,SP_ZENY);