diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-11-27 19:32:51 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-11-27 19:32:51 +0000 |
commit | 36125b1e1d1a55663e478d22bcaa8ef9c8e213b2 (patch) | |
tree | 3d4e98e4e3706a2a1361b1b7e1ec186cdb46e21e | |
parent | 62f2d74d8eec9704c7d6c5c221a8b93ab450decf (diff) | |
download | hercules-36125b1e1d1a55663e478d22bcaa8ef9c8e213b2.tar.gz hercules-36125b1e1d1a55663e478d22bcaa8ef9c8e213b2.tar.bz2 hercules-36125b1e1d1a55663e478d22bcaa8ef9c8e213b2.tar.xz hercules-36125b1e1d1a55663e478d22bcaa8ef9c8e213b2.zip |
- Some cleanups on the trade_additem function. When specifying a qty of 0, an ack will be returned to the client so it doesn't gets stuck.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9331 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r-- | Changelog-Trunk.txt | 2 | ||||
-rw-r--r-- | src/map/trade.c | 19 |
2 files changed, 16 insertions, 5 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 13d01c781..90bd90058 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -4,6 +4,8 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2006/11/27
+ * Some cleanups on the trade_additem function. When specifying a qty of 0,
+ an ack will be returned to the client so it doesn't gets stuck. [Skotlex]
* Update sql files [Toms]
* Corrected the skill animation for Absorb Spirits [Skotlex]
* Cleaned up a bit the implementation of how Gravity Field blocks the
diff --git a/src/map/trade.c b/src/map/trade.c index 78c630a32..02eb454d3 100644 --- a/src/map/trade.c +++ b/src/map/trade.c @@ -294,7 +294,13 @@ void trade_tradeadditem(struct map_session_data *sd, int index, int amount) { trade_tradecancel(sd);
return;
}
-
+
+ if (amount == 0)
+ { //Why do this.. ~.~ just send an ack, the item won't display on the trade window.
+ clif_tradeitemok(sd, index, 0);
+ return;
+ }
+
if (index == 0)
{ //Adding Zeny
if (amount >= 0 && amount <= sd->status.zeny && // check amount
@@ -302,14 +308,14 @@ void trade_tradeadditem(struct map_session_data *sd, int index, int amount) { { //Check Ok
sd->deal.zeny = amount;
clif_tradeadditem(sd, target_sd, 0, amount);
- } else //Cancel Transaction
- clif_tradeitemok(sd, 0, 1); //Send overweight when trying to add too much zeny? Hope they get the idea...
+ } else //Send overweight when trying to add too much zeny? Hope they get the idea...
+ clif_tradeitemok(sd, 0, 1);
return;
}
- //Add an Item
+
index = index -2; //Why the actual index used is -2?
//Item checks...
- if (index < 0 || index > MAX_INVENTORY)
+ if (index < 0 || index >= MAX_INVENTORY)
return;
if (amount < 0 || amount > sd->status.inventory[index].amount)
return;
@@ -332,7 +338,10 @@ void trade_tradeadditem(struct map_session_data *sd, int index, int amount) { break;
}
if (trade_i >= 10) //No space left
+ {
+ clif_tradeitemok(sd, index+2, 1);
return;
+ }
trade_weight = sd->inventory_data[index]->weight * amount;
if (target_sd->weight + sd->deal.weight + trade_weight > target_sd->max_weight)
|