summaryrefslogtreecommitdiff
path: root/src/map/trade.c
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-02-11 10:19:10 +0000
committerJared Adams <jaxad0127@gmail.com>2009-02-11 10:19:10 +0000
commit1704b358892a96884fdbd15d5f569c235568cb5d (patch)
treed2031cb3c7e3361de712692701b240b5f420be5d /src/map/trade.c
parentd2c373ca6405fd3654198fcc730f6bec6139ad9c (diff)
downloadtmwa-1704b358892a96884fdbd15d5f569c235568cb5d.tar.gz
tmwa-1704b358892a96884fdbd15d5f569c235568cb5d.tar.bz2
tmwa-1704b358892a96884fdbd15d5f569c235568cb5d.tar.xz
tmwa-1704b358892a96884fdbd15d5f569c235568cb5d.zip
Move zeny amount check earlier in trade commit
Diffstat (limited to 'src/map/trade.c')
-rw-r--r--src/map/trade.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/map/trade.c b/src/map/trade.c
index 5505e68..3be1e45 100644
--- a/src/map/trade.c
+++ b/src/map/trade.c
@@ -252,6 +252,12 @@ void trade_tradecommit(struct map_session_data *sd)
if( (sd->deal_locked >=1) && (target_sd->deal_locked >=1) ){ // both have pressed 'ok'
if(sd->deal_locked < 2) {sd->deal_locked=2;} // set locked to 2
if(target_sd->deal_locked==2) { // the other one pressed 'trade' too
+ if(sd->deal_zeny) {
+ if (sd->deal_zeny > sd->status.zeny) trade_tradecancel(sd);
+ }
+ if(target_sd->deal_zeny) {
+ if (target_sd->deal_zeny > target_sd->status.zeny) trade_tradecancel(sd);
+ }
for(trade_i=0; trade_i<10;trade_i++) {
if(sd->deal_item_amount[trade_i] != 0) {
int n=sd->deal_item_index[trade_i]-2;
@@ -277,7 +283,6 @@ void trade_tradecommit(struct map_session_data *sd)
}
}
if(sd->deal_zeny) {
- if (sd->deal_zeny > sd->status.zeny) trade_tradecancel(sd);
sd->status.zeny -= sd->deal_zeny;
clif_updatestatus(sd,SP_ZENY);
target_sd->status.zeny += sd->deal_zeny;
@@ -285,7 +290,6 @@ void trade_tradecommit(struct map_session_data *sd)
sd->deal_zeny=0;
}
if(target_sd->deal_zeny) {
- if (target_sd->deal_zeny > target_sd->status.zeny) trade_tradecancel(sd);
target_sd->status.zeny -= target_sd->deal_zeny;
clif_updatestatus(target_sd,SP_ZENY);
sd->status.zeny += target_sd->deal_zeny;