summaryrefslogtreecommitdiff
path: root/src/map/charcommand.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-02-13 15:04:11 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-02-13 15:04:11 +0000
commit78748079288acbd6e5fc7513baa70cf5b0a9a330 (patch)
treed2aada8ab9d3f91fbfd8f4453b527d5a1f1c13d9 /src/map/charcommand.c
parent802127420bf94a1f88696eb74feaf8917fa350cf (diff)
downloadhercules-78748079288acbd6e5fc7513baa70cf5b0a9a330.tar.gz
hercules-78748079288acbd6e5fc7513baa70cf5b0a9a330.tar.bz2
hercules-78748079288acbd6e5fc7513baa70cf5b0a9a330.tar.xz
hercules-78748079288acbd6e5fc7513baa70cf5b0a9a330.zip
- NPC_POWERUP now gives +40% atk per level.
- Water elementals can be frozen again. - Fixed the sc_def equation in status_change_start - Fixed an extra semi-colon that broke win32 compiles. - Some rewriting of bounds checks in @baselvup, @joblvup and the # equivalents to prevent signed/unsigned comparisons. - Now slaves give exp/loot (exception: player slaves still stick to the old rules) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5267 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/charcommand.c')
-rw-r--r--src/map/charcommand.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/map/charcommand.c b/src/map/charcommand.c
index 33beca832..b685f4bfd 100644
--- a/src/map/charcommand.c
+++ b/src/map/charcommand.c
@@ -1262,7 +1262,8 @@ int charcommand_baselevel(
clif_displaymessage(fd, msg_table[91]); // Character's base level can't go any higher.
return 0;
} // End Addition
- if (level > pc_maxbaselv(pl_sd) || level > (pc_maxbaselv(pl_sd)- (int)pl_sd->status.base_level)) // fix positiv overflow
+ if ((unsigned int)level > pc_maxbaselv(pl_sd) ||
+ pl_sd->status.base_level > pc_maxbaselv(pl_sd) -level)
level = pc_maxbaselv(pl_sd) - pl_sd->status.base_level;
for (i = 1; i <= level; i++)
pl_sd->status.status_point += (pl_sd->status.base_level + i + 14) / 5;
@@ -1279,16 +1280,17 @@ int charcommand_baselevel(
clif_displaymessage(fd, msg_table[193]); // Character's base level can't go any lower.
return -1;
}
- if (level < -(int)pc_maxbaselv(pl_sd) || level < (1 - (int)pl_sd->status.base_level)) // fix negativ overflow
- level = 1 - pl_sd->status.base_level;
+ level *= -1;
+ if ((unsigned int)level >= pl_sd->status.base_level)
+ level = pl_sd->status.base_level -1;
if (pl_sd->status.status_point > 0) {
- for (i = 0; i > level; i--)
- pl_sd->status.status_point -= (pl_sd->status.base_level + i + 14) / 5;
+ for (i = 0; i > -level; i--)
+ pl_sd->status.status_point -= (pl_sd->status.base_level +i + 14) / 5;
if (pl_sd->status.status_point < 0)
pl_sd->status.status_point = 0;
clif_updatestatus(pl_sd, SP_STATUSPOINT);
} // to add: remove status points from stats
- pl_sd->status.base_level += level;
+ pl_sd->status.base_level -= level;
clif_updatestatus(pl_sd, SP_BASELEVEL);
clif_updatestatus(pl_sd, SP_NEXTBASEEXP);
status_calc_pc(pl_sd, 0);
@@ -1333,7 +1335,8 @@ int charcommand_joblevel(
clif_displaymessage(fd, msg_table[67]); // Character's job level can't go any higher.
return -1;
}
- if ((int)pl_sd->status.job_level + level > pc_maxjoblv(pl_sd))
+ if ((unsigned int)level > pc_maxjoblv(pl_sd) ||
+ pl_sd->status.job_level > pc_maxjoblv(pl_sd) -level)
level = pc_maxjoblv(pl_sd) - pl_sd->status.job_level;
pl_sd->status.job_level += level;
clif_updatestatus(pl_sd, SP_JOBLEVEL);
@@ -1348,13 +1351,14 @@ int charcommand_joblevel(
clif_displaymessage(fd, msg_table[194]); // Character's job level can't go any lower.
return -1;
}
- if (pl_sd->status.job_level + level < 1)
- level = 1 - pl_sd->status.job_level;
- pl_sd->status.job_level += level;
+ level*=-1;
+ if ((unsigned int)level >= pl_sd->status.job_level)
+ level = pl_sd->status.job_level-1;
+ pl_sd->status.job_level -= level;
clif_updatestatus(pl_sd, SP_JOBLEVEL);
clif_updatestatus(pl_sd, SP_NEXTJOBEXP);
if (pl_sd->status.skill_point > 0) {
- pl_sd->status.skill_point += level;
+ pl_sd->status.skill_point -= level;
if (pl_sd->status.skill_point < 0)
pl_sd->status.skill_point = 0;
clif_updatestatus(pl_sd, SP_SKILLPOINT);