summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-11-28 10:50:31 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-11-28 10:50:31 +0000
commita85ac18efdbf3d53b5b46a66d0f36f7490a52a5b (patch)
tree68c1c14f46f54309f37328e51f19b23c8fc03691 /src/map/pc.c
parent522b376587fbf5793183c41d2916dec1232f762d (diff)
downloadhercules-a85ac18efdbf3d53b5b46a66d0f36f7490a52a5b.tar.gz
hercules-a85ac18efdbf3d53b5b46a66d0f36f7490a52a5b.tar.bz2
hercules-a85ac18efdbf3d53b5b46a66d0f36f7490a52a5b.tar.xz
hercules-a85ac18efdbf3d53b5b46a66d0f36f7490a52a5b.zip
- Reverted the position of the max_hp/max_sp basic setting, modified the max_hp/max_sp bonuses to use casting in order to work correctly with negative bonuses.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11832 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index bde2c5270..654d8836e 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -1543,20 +1543,18 @@ int pc_bonus(struct map_session_data *sd,int type,int val)
status->def_ele=val;
break;
case SP_MAXHP:
- if(sd->state.lr_flag != 2) {
- if (val < 0 && status->max_hp <= (unsigned int)(-val))
- status->max_hp = 1;
- else
- status->max_hp+=val;
- }
+ if(sd->state.lr_flag == 2)
+ break;
+ val += (int)status->max_hp;
+ //Negative bonuses will underflow, this will be handled in status_calc_pc through casting
+ //If this is called outside of status_calc_pc, you'd better pray they do not underflow and end with UINT_MAX max_hp.
+ status->max_hp = (unsigned int)val;
break;
case SP_MAXSP:
- if(sd->state.lr_flag != 2) {
- if (val < 0 && status->max_sp <= (unsigned int)(-val))
- status->max_sp = 1;
- else
- status->max_sp+=val;
- }
+ if(sd->state.lr_flag == 2)
+ break;
+ val += (int)status->max_sp;
+ status->max_sp = (unsigned int)val;
break;
case SP_CASTRATE:
if(sd->state.lr_flag != 2)