From c999af595f4a8f7d30b6d7c822e2a1caf3298389 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Tue, 15 Jul 2014 21:22:19 -0700 Subject: Revert bounds checks and go back to signed integers --- src/map/atcommand.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'src/map/atcommand.cpp') diff --git a/src/map/atcommand.cpp b/src/map/atcommand.cpp index a17838f..11f6eb1 100644 --- a/src/map/atcommand.cpp +++ b/src/map/atcommand.cpp @@ -1457,9 +1457,10 @@ ATCE atcommand_baselevelup(Session *s, dumb_ptr sd, if (sd->status.status_point > 0) { for (i = 0; i > level; i--) - sd->status.status_point -= std::min( - static_cast(sd->status.status_point), - (sd->status.base_level + i + 14) / 4); + sd->status.status_point -= + (sd->status.base_level + i + 14) / 4; + if (sd->status.status_point < 0) + sd->status.status_point = 0; clif_updatestatus(sd, SP::STATUSPOINT); } // to add: remove status points from stats @@ -1520,7 +1521,9 @@ ATCE atcommand_joblevelup(Session *s, dumb_ptr sd, clif_updatestatus(sd, SP::NEXTJOBEXP); if (sd->status.skill_point > 0) { - sd->status.skill_point += std::max(level, -sd->status.skill_point); + sd->status.skill_point += level; + if (sd->status.skill_point < 0) + sd->status.skill_point = 0; clif_updatestatus(sd, SP::SKILLPOINT); } // to add: remove status points from skills @@ -2585,9 +2588,10 @@ ATCE atcommand_character_baselevel(Session *s, dumb_ptr sd, if (pl_sd->status.status_point > 0) { for (i = 0; i > level; i--) - pl_sd->status.status_point -= std::min( - static_cast(pl_sd->status.status_point), - (pl_sd->status.base_level + i + 14) / 4); + pl_sd->status.status_point -= + (pl_sd->status.base_level + i + 14) / 4; + 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 @@ -2668,7 +2672,9 @@ ATCE atcommand_character_joblevel(Session *s, dumb_ptr sd, clif_updatestatus(pl_sd, SP::NEXTJOBEXP); if (pl_sd->status.skill_point > 0) { - pl_sd->status.skill_point += std::max(level, -pl_sd->status.skill_point); + 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); } // to add: remove status points from skills -- cgit v1.2.3-70-g09d2