summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-08-12 11:38:08 -0600
committerJared Adams <jaxad0127@gmail.com>2009-08-12 11:38:08 -0600
commitf6296b7d766a20ad7a48f8e4b01ce67402ae2931 (patch)
tree903a4da8f60f6d0e1e239e6eb2f4b4eb74b96406
parent37bdc8e72ec43e6e8f827ed77a1f93f5a8b0007f (diff)
downloadtmwa-f6296b7d766a20ad7a48f8e4b01ce67402ae2931.tar.gz
tmwa-f6296b7d766a20ad7a48f8e4b01ce67402ae2931.tar.bz2
tmwa-f6296b7d766a20ad7a48f8e4b01ce67402ae2931.tar.xz
tmwa-f6296b7d766a20ad7a48f8e4b01ce67402ae2931.zip
Fix adding equiped items to trade
-rw-r--r--src/map/pc.c24
-rw-r--r--src/map/pc.h1
-rw-r--r--src/map/trade.c1
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