summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-10-30 06:32:10 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-10-30 06:32:10 +0000
commitfe073716ed8f293e1d6e58dec42db1e5c7881149 (patch)
treec5d940c14039b8df2fed1d76422e79489d54a32e /src
parent3fdb1c0d3de24e8d7f582b40d0a7296be6aabf2c (diff)
downloadhercules-fe073716ed8f293e1d6e58dec42db1e5c7881149.tar.gz
hercules-fe073716ed8f293e1d6e58dec42db1e5c7881149.tar.bz2
hercules-fe073716ed8f293e1d6e58dec42db1e5c7881149.tar.xz
hercules-fe073716ed8f293e1d6e58dec42db1e5c7881149.zip
Small cleanup of r13321/r13322/r13331.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13338 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/atcommand.c40
-rw-r--r--src/map/charcommand.c40
2 files changed, 10 insertions, 70 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index e37c712af..cb438701c 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -1504,46 +1504,16 @@ int atcommand_heal(const int fd, struct map_session_data* sd, const char* comman
sscanf(message, "%d %d", &hp, &sp);
- if ( ( hp == 0 && sp == 0 )
- || ( hp > INT_MAX && sp > INT_MAX ) ) { // Prevent overflow. [Paradox924X]
- if (!status_percent_heal(&sd->bl, 100, 100))
- clif_displaymessage(fd, msg_txt(157)); // HP and SP have already been recovered.
- else
- clif_displaymessage(fd, msg_txt(17)); // HP, SP recovered.
- return 0;
- }
-
- // Prevent overflow. [Paradox924X]
- if ( hp < -INT_MAX && sp < -INT_MAX ) {
- status_damage(NULL, &sd->bl, INT_MAX, INT_MAX, 0, 0);
- clif_damage(&sd->bl,&sd->bl, gettick(), 0, 0, INT_MAX, 0, 4, 0);
- clif_displaymessage(fd, msg_txt(156)); // HP or/and SP modified.
- return 0;
- }
+ // some overflow checks
+ if( hp == INT_MIN ) hp++;
+ if( sp == INT_MIN ) sp++;
- // Prevent overflow. [Paradox924X]
- if ( hp > INT_MAX ) {
- if (!status_percent_heal(&sd->bl, 100, 0))
+ if ( hp == 0 && sp == 0 ) {
+ if (!status_percent_heal(&sd->bl, 100, 100))
clif_displaymessage(fd, msg_txt(157)); // HP and SP have already been recovered.
else
clif_displaymessage(fd, msg_txt(17)); // HP, SP recovered.
return 0;
- } else if ( hp < -INT_MAX ) {
- status_damage(NULL, &sd->bl, INT_MAX, 0, 0, 0);
- clif_damage(&sd->bl,&sd->bl, gettick(), 0, 0, INT_MAX, 0, 4, 0);
- clif_displaymessage(fd, msg_txt(156)); // HP or/and SP modified.
- return 0;
- }
-
- // Prevent overflow. [Paradox924X]
- if ( sp > INT_MAX ) {
- status_heal(&sd->bl, 0, INT_MAX, 0);
- clif_displaymessage(fd, msg_txt(156)); // HP or/and SP modified.
- return 0;
- } else if ( sp < -INT_MAX ) {
- status_damage(NULL, &sd->bl, 0, INT_MAX, 0, 0);
- clif_displaymessage(fd, msg_txt(156)); // HP or/and SP modified.
- return 0;
}
if ( hp > 0 && sp >= 0 ) {
diff --git a/src/map/charcommand.c b/src/map/charcommand.c
index 39d4f817e..cc25a6d28 100644
--- a/src/map/charcommand.c
+++ b/src/map/charcommand.c
@@ -1794,8 +1794,11 @@ int charcommand_heal(const int fd, struct map_session_data* sd, const char* comm
return -1;
}
- if ( ( hp == 0 && sp == 0 )
- || ( hp > INT_MAX && sp > INT_MAX ) ) { // Prevent overflow. [Paradox924X]
+ // some overflow checks
+ if( hp == INT_MIN ) hp++;
+ if( sp == INT_MIN ) sp++;
+
+ if ( hp == 0 && sp == 0 ) {
if (!status_percent_heal(&pl_sd->bl, 100, 100))
clif_displaymessage(fd, msg_txt(157)); // HP and SP are already with the good value.
else
@@ -1807,39 +1810,6 @@ int charcommand_heal(const int fd, struct map_session_data* sd, const char* comm
return 0;
}
- // Prevent overflow. [Paradox924X]
- if ( hp < -INT_MAX && sp < -INT_MAX ) {
- status_damage(NULL, &pl_sd->bl, INT_MAX, INT_MAX, 0, 0);
- clif_damage(&pl_sd->bl,&pl_sd->bl, gettick(), 0, 0, INT_MAX, 0 , 4, 0);
- clif_displaymessage(fd, msg_txt(156)); // HP or/and SP modified.
- return 0;
- }
-
- // Prevent overflow. [Paradox924X]
- if ( hp > INT_MAX ) {
- if (!status_percent_heal(&pl_sd->bl, 100, 0))
- clif_displaymessage(fd, msg_txt(157)); // HP and SP have already been recovered.
- else
- clif_displaymessage(fd, msg_txt(17)); // HP, SP recovered.
- return 0;
- } else if ( hp < -INT_MAX ) {
- status_damage(NULL, &pl_sd->bl, INT_MAX, 0, 0, 0);
- clif_damage(&pl_sd->bl,&pl_sd->bl, gettick(), 0, 0, INT_MAX, 0, 4, 0);
- clif_displaymessage(fd, msg_txt(156)); // HP or/and SP modified.
- return 0;
- }
-
- // Prevent overflow. [Paradox924X]
- if ( sp > INT_MAX ) {
- status_heal(&pl_sd->bl, 0, INT_MAX, 0);
- clif_displaymessage(fd, msg_txt(156)); // HP or/and SP modified.
- return 0;
- } else if ( sp < -INT_MAX ) {
- status_damage(NULL, &pl_sd->bl, 0, INT_MAX, 0, 0);
- clif_displaymessage(fd, msg_txt(156)); // HP or/and SP modified.
- return 0;
- }
-
if(hp > 0 && sp >= 0) {
if( !status_heal(&pl_sd->bl, hp, sp, 2) )
clif_displaymessage(fd, msg_txt(157)); // HP and SP are already with the good value.