diff options
author | epoque11 <epoque11@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2011-12-14 16:18:36 +0000 |
---|---|---|
committer | epoque11 <epoque11@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2011-12-14 16:18:36 +0000 |
commit | 6c066dc648e82dda2a41c596158adbf58ceda68b (patch) | |
tree | e4137759c4dc9c73f1d1bb8c00463210c7465f56 | |
parent | 2ea7dfb95394706661e2bd0295886c7cd5387add (diff) | |
download | hercules-6c066dc648e82dda2a41c596158adbf58ceda68b.tar.gz hercules-6c066dc648e82dda2a41c596158adbf58ceda68b.tar.bz2 hercules-6c066dc648e82dda2a41c596158adbf58ceda68b.tar.xz hercules-6c066dc648e82dda2a41c596158adbf58ceda68b.zip |
- Fixed mercenaries not warping to their master if the master is more than 15 cells away
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15108 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r-- | src/map/mercenary.h | 3 | ||||
-rw-r--r-- | src/map/unit.c | 11 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/map/mercenary.h b/src/map/mercenary.h index f040a3913..f63ffad86 100644 --- a/src/map/mercenary.h +++ b/src/map/mercenary.h @@ -7,6 +7,9 @@ #include "status.h" // struct status_data, struct status_change #include "unit.h" // struct unit_data +// number of cells that a mercenary can walk to from it's master before being warped +#define MAX_MER_DISTANCE 15 + enum { ARCH_MERC_GUILD, SPEAR_MERC_GUILD, diff --git a/src/map/unit.c b/src/map/unit.c index 0b338e1bc..0225b4b87 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -115,12 +115,14 @@ static int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data struct map_session_data *sd; struct mob_data *md; struct unit_data *ud; + struct mercenary_data *mrd; bl = map_id2bl(id); if(bl == NULL) return 0; sd = BL_CAST(BL_PC, bl); md = BL_CAST(BL_MOB, bl); + mrd = BL_CAST(BL_MER, bl); ud = unit_bl2ud(bl); if(ud == NULL) return 0; @@ -175,6 +177,11 @@ static int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data } else sd->areanpc_id=0; + if( sd->md && !check_distance_bl(&sd->bl, &sd->md->bl, MAX_MER_DISTANCE) ) + {// mercenary is too far from the master so warp the master's position + unit_warp( &sd->md->bl, sd->bl.m, sd->bl.x, sd->bl.y, CLR_TELEPORT ); + } + if (sd->state.gmaster_flag && (battle_config.guild_aura&((agit_flag || agit2_flag)?2:1)) && (battle_config.guild_aura&(map_flag_gvg2(bl->m)?8:4)) @@ -218,6 +225,10 @@ static int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data clif_move(ud); } } + else if( mrd && mrd->master && !check_distance_bl(&mrd->master->bl, bl, MAX_MER_DISTANCE) ) + {// mercenary is too far from the master so warp the master's position + unit_warp( bl, mrd->master->bl.id, mrd->master->bl.x, mrd->master->bl.y, CLR_TELEPORT ); + } if(tid == INVALID_TIMER) //A directly invoked timer is from battle_stop_walking, therefore the rest is irrelevant. return 0; |