# This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines.
--- Base (BASE)
+++ Locally Modified (Based On LOCAL)
@@ -112,6 +112,14 @@
return 1;
}
+int unit_teleport_timer(int tid, unsigned int tick, int id, intptr_t data){
+ TBL_MER *mrd = map_id2mc(id);
+ if (mrd->masterteleport_timer != INVALID_TIMER && !check_distance_bl(&sd->bl, &sd->md->bl, MAX_MER_DISTANCE)){
+ mrd->masterteleport_timer = 0;
+ unit_warp( mrd->bl, mrd->master->bl.id, mrd->master->bl.x, mrd->master->bl.y, CLR_TELEPORT );
+ }
+}
+
static int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data)
{
int i;
@@ -183,17 +191,15 @@
} else
sd->areanpc_id=0;
- if( sd->md && !check_distance_bl(&sd->bl, &sd->md->bl, MAX_MER_DISTANCE) )
- {
- // mercenary should be warped after being 3 seconds too far from the master [greenbox]
- if (sd->md->masterteleport_timer == 0)
- {
- sd->md->masterteleport_timer = gettick();
+ if( sd->md){
+ if (!check_distance_bl(&sd->bl, &sd->md->bl, MAX_MER_DISTANCE)) {
+ if(sd->md->masterteleport_timer == INVALID_TIMER)
+ sd->md->masterteleport_timer = add_timer(gettick()+3000,unit_teleport_timer,sd->md->bl.id,MAX_MER_DISTANCE);
}
- else if (DIFF_TICK(gettick(), sd->md->masterteleport_timer) > 3000)
- {
- sd->md->masterteleport_timer = 0;
- unit_warp( &sd->md->bl, sd->bl.m, sd->bl.x, sd->bl.y, CLR_TELEPORT );
+ else {
+ if(sd->md->masterteleport_timer != INVALID_TIMER)
+ delete_timer(sd->md->masterteleport_timer,unit_teleport_timer);
+ sd->md->masterteleport_timer = INVALID_TIMER; //cancel recall
}
}
else if( sd->md )
@@ -224,24 +230,16 @@
}
else if( mrd && mrd->master )
{
- if (!check_distance_bl(&mrd->master->bl, bl, MAX_MER_DISTANCE))
- {
- // mercenary should be warped after being 3 seconds too far from the master [greenbox]
- if (mrd->masterteleport_timer == 0)
- {
- mrd->masterteleport_timer = gettick();
+ if (!check_distance_bl(&mrd->master->bl, bl, MAX_MER_DISTANCE)) {
+ if(sd->md->masterteleport_timer == INVALID_TIMER)
+ sd->md->masterteleport_timer = add_timer(gettick()+3000,unit_teleport_timer,mrd->bl.id,MAX_MER_DISTANCE);
}
- else if (DIFF_TICK(gettick(), mrd->masterteleport_timer) > 3000)
- {
- mrd->masterteleport_timer = 0;
- unit_warp( bl, mrd->master->bl.id, mrd->master->bl.x, mrd->master->bl.y, CLR_TELEPORT );
+ else {
+ if(mrd->masterteleport_timer != INVALID_TIMER)
+ delete_timer(mrd->masterteleport_timer,unit_teleport_timer);
+ mrd->masterteleport_timer = INVALID_TIMER; //cancel recall
}
}
- else
- {
- mrd->masterteleport_timer = 0;
- }
- }
if(tid == INVALID_TIMER) //A directly invoked timer is from battle_stop_walking, therefore the rest is irrelevant.
return 0;