瀏覽代碼

Fixed bugreport:6320 where trading with multiple characters may lead to exploitation.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@16499 54d463be-8e91-2dee-dedb-b68131a5f0ec
rud0lp20 13 年之前
父節點
當前提交
0339913aa3
共有 1 個文件被更改,包括 10 次插入0 次删除
  1. 10 0
      src/map/trade.c

+ 10 - 0
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;