diff options
author | Paradox924X <Paradox924X@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2009-07-22 18:46:44 +0000 |
---|---|---|
committer | Paradox924X <Paradox924X@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2009-07-22 18:46:44 +0000 |
commit | 1edbaf25c049c76c4566b7919bb613d8a2a51176 (patch) | |
tree | cfcfb9171fdfc79cdfdd9d56db05d29c25f939d0 /src/map/status.c | |
parent | 26a4e327cf0797fc8922a5b45b07ded3206edc7e (diff) | |
download | hercules-1edbaf25c049c76c4566b7919bb613d8a2a51176.tar.gz hercules-1edbaf25c049c76c4566b7919bb613d8a2a51176.tar.bz2 hercules-1edbaf25c049c76c4566b7919bb613d8a2a51176.tar.xz hercules-1edbaf25c049c76c4566b7919bb613d8a2a51176.zip |
Added proper bounds of INT_MIN to INT_MAX for hp/sp when being sent to/from status_damage/status_heal for negative values because of INT_MAX being (-INT_MIN - 1).
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13955 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/status.c')
-rw-r--r-- | src/map/status.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/map/status.c b/src/map/status.c index eb480bc2c..857a0a7a7 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -637,12 +637,12 @@ int status_damage(struct block_list *src,struct block_list *target,int hp, int s sp = 0; //Not a valid SP target. if (hp < 0) { //Assume absorbed damage. - status_heal(target, -hp, 0, 1); + status_heal(target, cap_value(-hp, INT_MIN, INT_MAX), 0, 1); hp = 0; } if (sp < 0) { - status_heal(target, 0, -sp, 1); + status_heal(target, 0, cap_value(-sp, INT_MIN, INT_MAX), 1); sp = 0; } @@ -859,7 +859,7 @@ int status_heal(struct block_list *bl,int hp,int sp, int flag) sc = NULL; if (hp < 0) { - status_damage(NULL, bl, -hp, 0, 0, 1); + status_damage(NULL, bl, cap_value(-hp, INT_MIN, INT_MAX), 0, 0, 1); hp = 0; } @@ -872,7 +872,7 @@ int status_heal(struct block_list *bl,int hp,int sp, int flag) } if(sp < 0) { - status_damage(NULL, bl, 0, -sp, 0, 1); + status_damage(NULL, bl, 0, cap_value(-sp, INT_MIN, INT_MAX), 0, 1); sp = 0; } |