summaryrefslogtreecommitdiff
path: root/src/map/atcommand.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r--src/map/atcommand.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 31bf7b3ce..99c13339d 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -2680,7 +2680,7 @@ int atcommand_baselevelup(
clif_displaymessage(fd, msg_table[47]); /* Base level can't go any higher. */
return -1;
} /* End Addition */
- if (level > pc_maxbaselv(sd) || level > (pc_maxbaselv(sd) - (int)sd->status.base_level)) // fix positiv overflow
+ if (level > pc_maxbaselv(sd) || level > pc_maxbaselv(sd) - sd->status.base_level) // fix positiv overflow
level = pc_maxbaselv(sd) - sd->status.base_level;
for (i = 1; i <= level; i++)
sd->status.status_point += (sd->status.base_level + i + 14) / 5;
@@ -2697,10 +2697,11 @@ int atcommand_baselevelup(
clif_displaymessage(fd, msg_table[158]); /* Base level can't go any lower. */
return -1;
}
- if (level < -(int)pc_maxbaselv(sd) || level < (1 - (int)sd->status.base_level)) /* fix negativ overflow */
- level = 1 - sd->status.base_level;
+ level*=-1;
+ if (level >= sd->status.base_level)
+ level = sd->status.base_level-1;
if (sd->status.status_point > 0) {
- for (i = 0; i > level; i--)
+ for (i = 0; i > -level; i--)
sd->status.status_point -= (sd->status.base_level + i + 14) / 5;
if (sd->status.status_point < 0)
sd->status.status_point = 0;
@@ -2739,7 +2740,7 @@ int atcommand_joblevelup(
clif_displaymessage(fd, msg_table[23]); // Job level can't go any higher.
return -1;
}
- if (level > pc_maxjoblv(sd) || level > (pc_maxjoblv(sd) - (int)sd->status.job_level)) // fix positiv overflow
+ if (level > pc_maxjoblv(sd) || level > pc_maxjoblv(sd) - sd->status.job_level) // fix positiv overflow
level = pc_maxjoblv(sd) - sd->status.job_level;
sd->status.job_level += level;
clif_updatestatus(sd, SP_JOBLEVEL);
@@ -2754,13 +2755,14 @@ int atcommand_joblevelup(
clif_displaymessage(fd, msg_table[159]); // Job level can't go any lower.
return -1;
}
- if (level < -(int)pc_maxjoblv(sd) || level < (1 - (int)sd->status.job_level)) // fix negativ overflow
- level = 1 - sd->status.job_level;
- sd->status.job_level += level;
+ level *=-1;
+ if (level >= sd->status.job_level) // fix negativ overflow
+ level = sd->status.job_level-1;
+ sd->status.job_level -= level;
clif_updatestatus(sd, SP_JOBLEVEL);
clif_updatestatus(sd, SP_NEXTJOBEXP);
if (sd->status.skill_point > 0) {
- sd->status.skill_point += level;
+ sd->status.skill_point -= level;
if (sd->status.skill_point < 0)
sd->status.skill_point = 0;
clif_updatestatus(sd, SP_SKILLPOINT);