From f6296b7d766a20ad7a48f8e4b01ce67402ae2931 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Wed, 12 Aug 2009 11:38:08 -0600 Subject: Fix adding equiped items to trade --- src/map/pc.c | 24 +++++++++++++++++------- src/map/pc.h | 1 + src/map/trade.c | 1 + 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/map/pc.c b/src/map/pc.c index 570ceb6..e0b4c89 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -2948,7 +2948,6 @@ int pc_delitem(struct map_session_data *sd,int n,int amount,int type) */ int pc_dropitem(struct map_session_data *sd,int n,int amount) { - int i; nullpo_retr(1, sd); if (sd->trade_partner != 0 || sd->npc_id != 0 || sd->state.storage_flag) @@ -2960,12 +2959,7 @@ int pc_dropitem(struct map_session_data *sd,int n,int amount) if(amount <= 0) return 0; - for (i = 0; i < 11; i++) { - if (equip_pos[i] > 0 && sd->equip_index[i] == n) { //Slot taken, remove item from there. - pc_unequipitem(sd, sd->equip_index[i], 1); - sd->equip_index[i] = -1; - } - } + pc_unequipinvyitem(sd, n, 1); if (sd->status.inventory[n].nameid <= 0 || @@ -6507,6 +6501,22 @@ int pc_unequipitem(struct map_session_data *sd,int n,int type) return 0; } +int pc_unequipinvyitem(struct map_session_data* sd, int n, int type) +{ + int i; + + nullpo_retr(1, sd); + + for (i = 0; i < 11; i++) { + if (equip_pos[i] > 0 && sd->equip_index[i] == n) { //Slot taken, remove item from there. + pc_unequipitem(sd, sd->equip_index[i], type); + sd->equip_index[i] = -1; + } + } + + return 0; +} + /*========================================== * �A�C�e����index�ԍ����l�߂��� * �� ���i�̑����”\�`�F�b�N���s�Ȃ� diff --git a/src/map/pc.h b/src/map/pc.h index 0af9a20..31d8c8a 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -126,6 +126,7 @@ int pc_resetstate(struct map_session_data*); int pc_resetskill(struct map_session_data*); int pc_equipitem(struct map_session_data*,int,int); int pc_unequipitem(struct map_session_data*,int,int); +int pc_unequipinvyitem(struct map_session_data*,int,int); int pc_checkitem(struct map_session_data*); int pc_useitem(struct map_session_data*,int); diff --git a/src/map/trade.c b/src/map/trade.c index 8880629..67ac257 100644 --- a/src/map/trade.c +++ b/src/map/trade.c @@ -147,6 +147,7 @@ void trade_tradeadditem(struct map_session_data *sd,int index,int amount) return; } } + pc_unequipinvyitem(sd, index - 2, 1); sd->deal_item_index[trade_i] =index; sd->deal_item_amount[trade_i]+=amount; clif_tradeitemok(sd,index,amount,0); //success to add item -- cgit v1.2.3-70-g09d2