|
@@ -19,6 +19,8 @@
|
|
#include "log.h"
|
|
#include "log.h"
|
|
#include "../common/malloc.h"
|
|
#include "../common/malloc.h"
|
|
|
|
|
|
|
|
+//Max distance from traders to enable a trade to take place.
|
|
|
|
+#define TRADE_DISTANCE 2
|
|
|
|
|
|
/*==========================================
|
|
/*==========================================
|
|
* Initiates a trade request.
|
|
* Initiates a trade request.
|
|
@@ -61,8 +63,8 @@ void trade_traderequest(struct map_session_data *sd, struct map_session_data *ta
|
|
|
|
|
|
//Fixed. Only real GMs can request trade from far away! [Lupus]
|
|
//Fixed. Only real GMs can request trade from far away! [Lupus]
|
|
if (level < lowest_gm_level && (sd->bl.m != target_sd->bl.m ||
|
|
if (level < lowest_gm_level && (sd->bl.m != target_sd->bl.m ||
|
|
- (sd->bl.x - target_sd->bl.x <= -5 || sd->bl.x - target_sd->bl.x >= 5) ||
|
|
|
|
- (sd->bl.y - target_sd->bl.y <= -5 || sd->bl.y - target_sd->bl.y >= 5))) {
|
|
|
|
|
|
+ !check_distance_bl(&sd->bl, &target_sd->bl, TRADE_DISTANCE)
|
|
|
|
+ )) {
|
|
clif_tradestart(sd, 0); // too far
|
|
clif_tradestart(sd, 0); // too far
|
|
return ;
|
|
return ;
|
|
}
|
|
}
|
|
@@ -93,9 +95,8 @@ void trade_tradeack(struct map_session_data *sd, int type) {
|
|
|
|
|
|
//Copied here as well since the original character could had warped.
|
|
//Copied here as well since the original character could had warped.
|
|
if (type == 3 && pc_isGM(target_sd) < lowest_gm_level && (sd->bl.m != target_sd->bl.m ||
|
|
if (type == 3 && pc_isGM(target_sd) < lowest_gm_level && (sd->bl.m != target_sd->bl.m ||
|
|
- (sd->bl.x - target_sd->bl.x <= -5 || sd->bl.x - target_sd->bl.x >= 5) ||
|
|
|
|
- (sd->bl.y - target_sd->bl.y <= -5 || sd->bl.y - target_sd->bl.y >= 5)))
|
|
|
|
- {
|
|
|
|
|
|
+ !check_distance_bl(&sd->bl, &target_sd->bl, TRADE_DISTANCE)
|
|
|
|
+ )) {
|
|
sd->trade_partner=0;
|
|
sd->trade_partner=0;
|
|
target_sd->trade_partner = 0;
|
|
target_sd->trade_partner = 0;
|
|
clif_tradestart(sd, 0); // too far
|
|
clif_tradestart(sd, 0); // too far
|