summaryrefslogtreecommitdiff
path: root/src/map/trade.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-07-06 21:22:20 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-07-06 21:22:20 +0000
commit5b1d1678fd03d6c780e933f6e464e3b02a860c0d (patch)
tree65b746ac53e67d12d9958223e095697bb8f20123 /src/map/trade.c
parent7afdfd0b4b60c52af9f4e488bb1208a426a5bddc (diff)
downloadhercules-5b1d1678fd03d6c780e933f6e464e3b02a860c0d.tar.gz
hercules-5b1d1678fd03d6c780e933f6e464e3b02a860c0d.tar.bz2
hercules-5b1d1678fd03d6c780e933f6e464e3b02a860c0d.tar.xz
hercules-5b1d1678fd03d6c780e933f6e464e3b02a860c0d.zip
- Rewrote all the item restriction functions so that they will take into account slotted card restrictions as well.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7552 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/trade.c')
-rw-r--r--src/map/trade.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/map/trade.c b/src/map/trade.c
index b9c142332..04d4c83e5 100644
--- a/src/map/trade.c
+++ b/src/map/trade.c
@@ -294,7 +294,8 @@ int trade_check(struct map_session_data *sd, struct map_session_data *tsd) {
*/
void trade_tradeadditem(struct map_session_data *sd, int index, int amount) {
struct map_session_data *target_sd;
- int trade_i, trade_weight, nameid;
+ struct item *item;
+ int trade_i, trade_weight;
nullpo_retv(sd);
if (!sd->state.trading || sd->state.deal_locked > 0)
@@ -324,10 +325,12 @@ void trade_tradeadditem(struct map_session_data *sd, int index, int amount) {
if (amount < 0 || amount > sd->status.inventory[index].amount)
return;
- nameid = sd->inventory_data[index]->nameid;
-
- if (!itemdb_cantrade(nameid, pc_isGM(sd), pc_isGM(target_sd)) && //Can't trade
- (pc_get_partner(sd) != target_sd || !itemdb_canpartnertrade(nameid, pc_isGM(sd), pc_isGM(target_sd)))) //Can't partner-trade
+ item = &sd->status.inventory[index];
+ trade_i = pc_isGM(sd); //Recycling the variables to check for trad restrict.
+ trade_weight = pc_isGM(target_sd);
+ if (!itemdb_cantrade(item, trade_i, trade_weight) && //Can't trade
+ (pc_get_partner(sd) != target_sd ||
+ !itemdb_canpartnertrade(item, trade_i, trade_weight))) //Can't partner-trade
{
clif_displaymessage (sd->fd, msg_txt(260));
return;