diff options
author | shennetsind <ind@henn.et> | 2014-09-20 18:18:07 -0300 |
---|---|---|
committer | shennetsind <ind@henn.et> | 2014-09-20 18:18:07 -0300 |
commit | 34624b97980e256256897832eda4c7a8c00ca725 (patch) | |
tree | abcceb5b2e77f0d5e4be874701249c73336fb0b7 /src | |
parent | a9cbfd803a82464e9d715f806409526cedb25537 (diff) | |
download | hercules-34624b97980e256256897832eda4c7a8c00ca725.tar.gz hercules-34624b97980e256256897832eda4c7a8c00ca725.tar.bz2 hercules-34624b97980e256256897832eda4c7a8c00ca725.tar.xz hercules-34624b97980e256256897832eda4c7a8c00ca725.zip |
Fixed Bug 8301
reloadscript now clears npc-spawned (by warpportal script command) warps properly.
Special Thanks to Emistry, Cydh
http://hercules.ws/board/tracker/issue-8301-warpportal-reloadscript-map-server-error/
Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src')
-rw-r--r-- | src/map/npc.c | 8 | ||||
-rw-r--r-- | src/map/script.c | 6 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/map/npc.c b/src/map/npc.c index f4f20a60d..ac4d4555d 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -2179,6 +2179,10 @@ int npc_unload(struct npc_data* nd, bool single) { nullpo_ret(nd); + if( nd->ud && nd->ud != &npc->base_ud ) { + skill->clear_unitgroup(&nd->bl); + } + npc->remove_map(nd); map->deliddb(&nd->bl); if( single ) @@ -2216,7 +2220,7 @@ int npc_unload(struct npc_data* nd, bool single) { npc->ev_db->foreach(npc->ev_db,npc->unload_ev,nd->exname); //Clean up all events related npc->ev_label_db->foreach(npc->ev_label_db,npc->unload_ev_label,nd); } - + iter = mapit_geteachpc(); for( bl = (struct block_list*)mapit->first(iter); mapit->exists(iter); bl = (struct block_list*)mapit->next(iter) ) { struct map_session_data *sd = ((TBL_PC*)bl); @@ -2263,7 +2267,7 @@ int npc_unload(struct npc_data* nd, bool single) { guild->flag_remove(nd); } - if( nd->ud != &npc->base_ud ) { + if( nd->ud && nd->ud != &npc->base_ud ) { aFree(nd->ud); nd->ud = NULL; } diff --git a/src/map/script.c b/src/map/script.c index 3b5264de9..f46ee78fe 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -15909,8 +15909,7 @@ BUILDIN(warpportal) { struct block_list* bl; bl = map->id2bl(st->oid); - if( bl == NULL ) - { + if( bl == NULL ) { ShowError("script:warpportal: npc is needed\n"); return false; } @@ -15924,6 +15923,9 @@ BUILDIN(warpportal) { if( map_index == 0 ) return true;// map not found + if( bl->type == BL_NPC ) + unit->bl2ud2(bl); // ensure nd->ud is safe to edit + group = skill->unitsetting(bl, AL_WARP, 4, spx, spy, 0); if( group == NULL ) return true;// failed |