diff options
author | Jared Adams <jaxad0127@gmail.com> | 2008-10-12 23:19:16 +0000 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2008-10-12 23:19:16 +0000 |
commit | 8392585798dc7fb37a5ddd38ecde399ebf25b236 (patch) | |
tree | 22850025a9772546351bbb0b3dac3fb2f0e75816 /src/map | |
parent | cc3998bdd9ceff47fcc5577a3088fbfb5b455076 (diff) | |
download | tmwa-8392585798dc7fb37a5ddd38ecde399ebf25b236.tar.gz tmwa-8392585798dc7fb37a5ddd38ecde399ebf25b236.tar.bz2 tmwa-8392585798dc7fb37a5ddd38ecde399ebf25b236.tar.xz tmwa-8392585798dc7fb37a5ddd38ecde399ebf25b236.zip |
Fix drop logic inversion
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/pc.c | 60 |
1 files changed, 40 insertions, 20 deletions
diff --git a/src/map/pc.c b/src/map/pc.c index 41bfe31..fe8dab4 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -3040,30 +3040,50 @@ int pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem) { int flag; unsigned int tick = gettick(); + int can_take; nullpo_retr(0, sd); nullpo_retr(0, fitem); - if (can_pick_item_up_from (sd, fitem->first_get_id) - || fitem->first_get_tick <= tick) - if (can_pick_item_up_from (sd, fitem->second_get_id) - || fitem->second_get_tick <= tick) - if (can_pick_item_up_from (sd, fitem->third_get_id) - || fitem->third_get_tick <= tick) { - /* Can pick up */ - - if((flag = pc_additem(sd,&fitem->item_data,fitem->item_data.amount))) - // d—Êover‚Ŏ擾Ž¸”s - clif_additem(sd,0,0,flag); - else { - /* Žæ“¾¬Œ÷ */ - if(sd->attacktimer != -1) - pc_stopattack(sd); - clif_takeitem(&sd->bl,&fitem->bl); - map_clearflooritem(fitem->bl.id); - } - return 0; - } + /* Sometimes the owners reported to us are buggy: */ + + if (fitem->first_get_id == fitem->third_get_id + || fitem->second_get_id == fitem->third_get_id) + fitem->third_get_id = 0; + + if (fitem->first_get_id == fitem->second_get_id) { + fitem->second_get_id = fitem->third_get_id; + fitem->third_get_id = 0; + } + + can_take = can_pick_item_up_from (sd, fitem->first_get_id); + + if (!can_take) + can_take = fitem->first_get_tick <= tick + && can_pick_item_up_from (sd, fitem->second_get_id); + + if (!can_take) + can_take = fitem->second_get_tick <= tick + && can_pick_item_up_from (sd, fitem->third_get_id); + + if (!can_take) + can_take = fitem->third_get_tick <= tick; + + if (can_take) { + /* Can pick up */ + + if((flag = pc_additem(sd,&fitem->item_data,fitem->item_data.amount))) + // d—Êover‚Ŏ擾Ž¸”s + clif_additem(sd,0,0,flag); + else { + /* Žæ“¾¬Œ÷ */ + if(sd->attacktimer != -1) + pc_stopattack(sd); + clif_takeitem(&sd->bl,&fitem->bl); + map_clearflooritem(fitem->bl.id); + } + return 0; + } /* Otherwise, we can't pick up */ clif_additem(sd,0,0,6); |