summaryrefslogtreecommitdiff
path: root/src/map/trade.c
diff options
context:
space:
mode:
authorrud0lp20 <rud0lp20@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-07-25 12:08:57 +0000
committerrud0lp20 <rud0lp20@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-07-25 12:08:57 +0000
commitc270812e8cf450eb53c03bd018e943cf04abbf11 (patch)
tree4a5141afa0697f5c5052d6bca66e68c494c3e11a /src/map/trade.c
parentfd771e108750e68f1319d89a4f6ab1bbfa8fe5da (diff)
downloadhercules-c270812e8cf450eb53c03bd018e943cf04abbf11.tar.gz
hercules-c270812e8cf450eb53c03bd018e943cf04abbf11.tar.bz2
hercules-c270812e8cf450eb53c03bd018e943cf04abbf11.tar.xz
hercules-c270812e8cf450eb53c03bd018e943cf04abbf11.zip
Fixed bugreport:6320 where trading with multiple characters may lead to exploitation.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16499 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/trade.c')
-rw-r--r--src/map/trade.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/map/trade.c b/src/map/trade.c
index cfc4992e8..e8a58fd9b 100644
--- a/src/map/trade.c
+++ b/src/map/trade.c
@@ -54,6 +54,16 @@ void trade_traderequest(struct map_session_data *sd, struct map_session_data *ta
}
}
+ if ( sd->trade_partner != 0 ) { // If a character tries to trade to another one then cancel the previous one
+ struct map_session_data *previous_sd = map_id2sd(sd->trade_partner);
+ if( previous_sd ){
+ previous_sd->trade_partner = 0;
+ clif_tradecancelled(previous_sd);
+ } // Once cancelled then continue to the new one.
+ sd->trade_partner = 0;
+ clif_tradecancelled(sd);
+ }
+
if (target_sd->trade_partner != 0) {
clif_tradestart(sd, 2); // person is in another trade
return;