From a3fecfc4e984f3f734f5f5481f1b756ad3b93caf Mon Sep 17 00:00:00 2001 From: panikon Date: Mon, 31 Mar 2014 17:26:34 -0300 Subject: Updated documentation for pc_statusup2 and pc_statusup (fixed issue: 7916 http://hercules.ws/board/tracker/issue-7916-wrong-comment-in-pc-statusup2/) Now pc_statusup2 returns stat increase amount as stated in previous documentation Updated *statusup documentation it was wrong Added last update in upgrade index @console.c/.h Documented partially Now two different parsing categories can have functions with same name e.g. - server exit - sql exit --- src/map/clif.c | 10 +++++++++- src/map/pc.c | 22 +++++++++++++--------- 2 files changed, 22 insertions(+), 10 deletions(-) (limited to 'src/map') diff --git a/src/map/clif.c b/src/map/clif.c index e78c034cb..2dbe7cb96 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -11177,7 +11177,15 @@ void clif_parse_ChangeCart(int fd,struct map_session_data *sd) /// Old clients send always 1 for this, even when using /str+ and the like. /// Newer clients (2013-12-23 and newer) send the correct amount. void clif_parse_StatusUp(int fd,struct map_session_data *sd) { - pc->statusup(sd,RFIFOW(fd,2), RFIFOB(fd, 4)); + int increase_amount; + + increase_amount = RFIFOB(fd,4); + if( increase_amount < 0 ) + { + ShowDebug("clif_parse_StatusUp: Negative 'increase' value sent by client! (fd: %d, value: %d)\n", + fd, increase_amount); + } + pc->statusup(sd, RFIFOW(fd,2), increase_amount); } diff --git a/src/map/pc.c b/src/map/pc.c index 268125ae1..249b5f0b1 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -6220,7 +6220,7 @@ int pc_maxparameterincrease(struct map_session_data* sd, int type) { /** * Raises a stat by the specified amount. * Obeys max_parameter limits. - * Subtracts stat points. + * Does not subtract stat points. * * @param sd The target character. * @param type The stat to change (see enum _sp) @@ -6275,12 +6275,16 @@ bool pc_statusup(struct map_session_data* sd, int type, int increase) { return true; } -/// Raises a stat by the specified amount. -/// Obeys max_parameter limits. -/// Does not subtract stat points. -/// -/// @param type The stat to change (see enum _sp) -/// @param val The stat increase amount. +/** + * Raises a stat by the specified amount. + * Obeys max_parameter limits. + * Subtracts stat points. + * + * @param sd The target character. + * @param type The stat to change (see enum _sp) + * @param increase The stat increase amount. + * @return zero if no changes were made, otherwise returns stat increase amount + */ int pc_statusup2(struct map_session_data* sd, int type, int val) { int max, need; @@ -6289,7 +6293,7 @@ int pc_statusup2(struct map_session_data* sd, int type, int val) if( type < SP_STR || type > SP_LUK ) { clif->statusupack(sd,type,0,0); - return 1; + return 0; } need = pc->need_status_point(sd,type,1); @@ -6309,7 +6313,7 @@ int pc_statusup2(struct map_session_data* sd, int type, int val) if( val > 255 ) clif->updatestatus(sd,type); // send after the 'ack' to override the truncated value - return 0; + return val; } /*========================================== -- cgit v1.2.3-70-g09d2