|
@@ -1794,8 +1794,11 @@ int charcommand_heal(const int fd, struct map_session_data* sd, const char* comm
|
|
return -1;
|
|
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))
|
|
if (!status_percent_heal(&pl_sd->bl, 100, 100))
|
|
clif_displaymessage(fd, msg_txt(157)); // HP and SP are already with the good value.
|
|
clif_displaymessage(fd, msg_txt(157)); // HP and SP are already with the good value.
|
|
else
|
|
else
|
|
@@ -1807,39 +1810,6 @@ int charcommand_heal(const int fd, struct map_session_data* sd, const char* comm
|
|
return 0;
|
|
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(hp > 0 && sp >= 0) {
|
|
if( !status_heal(&pl_sd->bl, hp, sp, 2) )
|
|
if( !status_heal(&pl_sd->bl, hp, sp, 2) )
|
|
clif_displaymessage(fd, msg_txt(157)); // HP and SP are already with the good value.
|
|
clif_displaymessage(fd, msg_txt(157)); // HP and SP are already with the good value.
|