From c270812e8cf450eb53c03bd018e943cf04abbf11 Mon Sep 17 00:00:00 2001 From: rud0lp20 Date: Wed, 25 Jul 2012 12:08:57 +0000 Subject: 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 --- src/map/trade.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/map/trade.c') 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; -- cgit v1.2.3-60-g2f50