Explorar el Código

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 hace 13 años
padre
commit
0339913aa3
Se han modificado 1 ficheros con 10 adiciones y 0 borrados
  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;