summaryrefslogtreecommitdiff
path: root/src/map/clif.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2014-08-20 04:55:22 +0200
committerHaru <haru@dotalux.com>2014-08-20 04:58:02 +0200
commit769b1d05aa5cfa8cddfe7d21b35d5c5e4da3bbd6 (patch)
tree99907d827264e501774e58ab4630e41fa7103c02 /src/map/clif.c
parentb294026e6614a652c23bb0cea8a0d4dc69d8b125 (diff)
downloadhercules-769b1d05aa5cfa8cddfe7d21b35d5c5e4da3bbd6.tar.gz
hercules-769b1d05aa5cfa8cddfe7d21b35d5c5e4da3bbd6.tar.bz2
hercules-769b1d05aa5cfa8cddfe7d21b35d5c5e4da3bbd6.tar.xz
hercules-769b1d05aa5cfa8cddfe7d21b35d5c5e4da3bbd6.zip
Follow-up to b294026e6614a652c23bb0cea8a0d4dc69d8b125
- Added documentation for the pc->search_item function and formalized its return values. If the searched item is not found, now it returns the newly introduced constant INDEX_NOT_FOUND. - Updated pc->search_item checks to make use of INDEX_NOT_FOUND. - Fixed an issue with anvils not detected by the weapon forginc code, if they were in the first position of the inventory. - Added ITEMID constants for the four anvil types. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/clif.c')
-rw-r--r--src/map/clif.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index e6953d7a2..d9acf0792 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -3486,10 +3486,10 @@ void clif_arrow_create_list(struct map_session_data *sd)
WFIFOW(fd,0) = 0x1ad;
for (i = 0, c = 0; i < MAX_SKILL_ARROW_DB; i++) {
- if (skill->arrow_db[i].nameid > 0 &&
- (j = pc->search_inventory(sd, skill->arrow_db[i].nameid)) >= 0 &&
- !sd->status.inventory[j].equip && sd->status.inventory[j].identify)
- {
+ if (skill->arrow_db[i].nameid > 0
+ && (j = pc->search_inventory(sd, skill->arrow_db[i].nameid)) != INDEX_NOT_FOUND
+ && !sd->status.inventory[j].equip && sd->status.inventory[j].identify
+ ) {
if ((j = itemdb_viewid(skill->arrow_db[i].nameid)) > 0)
WFIFOW(fd,c*2+4) = j;
else
@@ -14615,7 +14615,7 @@ void clif_parse_AutoRevive(int fd, struct map_session_data *sd) {
int item_position = pc->search_inventory(sd, ITEMID_TOKEN_OF_SIEGFRIED);
int hpsp = 100;
- if (item_position < 0) {
+ if (item_position == INDEX_NOT_FOUND) {
if (sd->sc.data[SC_LIGHT_OF_REGENE])
hpsp = 20 * sd->sc.data[SC_LIGHT_OF_REGENE]->val1;
else
@@ -14628,7 +14628,7 @@ void clif_parse_AutoRevive(int fd, struct map_session_data *sd) {
if (!status->revive(&sd->bl, hpsp, hpsp))
return;
- if ( item_position < 0)
+ if (item_position == INDEX_NOT_FOUND)
status_change_end(&sd->bl,SC_LIGHT_OF_REGENE,INVALID_TIMER);
else
pc->delitem(sd, item_position, 1, 0, 1, LOG_TYPE_CONSUME);