diff options
author | Haru <haru@dotalux.com> | 2019-09-22 21:29:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-22 21:29:27 +0200 |
commit | 92f3ecdcb341b798c93d5c8b0320fb8cb85e759c (patch) | |
tree | 7a0b7ceed81e106c18867bc8b95d6377467e7a84 /src | |
parent | 17c91e48997ec3225618736c294195a8e39d05d2 (diff) | |
parent | 375e9a54f5e8aaef083f60cb36bad59f37e40905 (diff) | |
download | hercules-92f3ecdcb341b798c93d5c8b0320fb8cb85e759c.tar.gz hercules-92f3ecdcb341b798c93d5c8b0320fb8cb85e759c.tar.bz2 hercules-92f3ecdcb341b798c93d5c8b0320fb8cb85e759c.tar.xz hercules-92f3ecdcb341b798c93d5c8b0320fb8cb85e759c.zip |
Merge pull request #2525 from MishimaHaruna/tombstone-fixes
Tombstone fixes
Diffstat (limited to 'src')
-rw-r--r-- | src/map/mob.c | 8 | ||||
-rw-r--r-- | src/map/npc.c | 13 | ||||
-rw-r--r-- | src/map/pc.h | 1 |
3 files changed, 19 insertions, 3 deletions
diff --git a/src/map/mob.c b/src/map/mob.c index bad3f7eb8..e04d6944e 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -239,6 +239,14 @@ static void mvptomb_destroy(struct mob_data *md) m = nd->bl.m; + struct s_mapiterator *iter = mapit_geteachpc(); + for (struct map_session_data *sd = BL_UCAST(BL_PC, mapit->first(iter)); mapit->exists(iter); sd = BL_UCAST(BL_PC, mapit->next(iter))) { + if (sd->npc_id == nd->bl.id) { + sd->state.npc_unloaded = 1; + } + } + mapit->free(iter); + clif->clearunit_area(&nd->bl,CLR_OUTSIGHT); map->delblock(&nd->bl); diff --git a/src/map/npc.c b/src/map/npc.c index c3dff5870..868b8711a 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -1258,6 +1258,9 @@ static void run_tomb(struct map_session_data *sd, struct npc_data *nd) char time[10]; nullpo_retv(nd); + + sd->npc_id = nd->bl.id; + strftime(time, sizeof(time), "%H:%M", localtime(&nd->u.tomb.kill_time)); // TODO: Find exact color? @@ -1349,8 +1352,10 @@ static int npc_scriptcont(struct map_session_data *sd, int id, bool closing) return 1; } - if(id != npc->fake_nd->bl.id) { // Not item script - if ((npc->checknear(sd,target)) == NULL){ + if (id != npc->fake_nd->bl.id) { // Not item script + if (sd->state.npc_unloaded != 0) { + sd->state.npc_unloaded = 0; + } else if ((npc->checknear(sd,target)) == NULL) { ShowWarning("npc_scriptcont: failed npc->checknear test.\n"); return 1; } @@ -1371,8 +1376,10 @@ static int npc_scriptcont(struct map_session_data *sd, int id, bool closing) if( sd->progressbar.npc_id && DIFF_TICK(sd->progressbar.timeout,timer->gettick()) > 0 ) return 1; - if( !sd->st ) + if( !sd->st ) { + sd->npc_id = 0; return 1; + } if( closing && sd->st->state == CLOSE ) sd->st->state = END; diff --git a/src/map/pc.h b/src/map/pc.h index 49edea61b..2d21dabf6 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -238,6 +238,7 @@ struct map_session_data { unsigned int loggingout : 1; unsigned int warp_clean : 1; unsigned int refine_ui : 1; + unsigned int npc_unloaded : 1; ///< The player is talking with an unloaded NPCs (respawned tombstones) } state; struct { unsigned char no_weapon_damage, no_magic_damage, no_misc_damage; |