summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/map/instance.c30
-rw-r--r--src/map/npc.c2
2 files changed, 30 insertions, 2 deletions
diff --git a/src/map/instance.c b/src/map/instance.c
index fcbc03e5e..44b735518 100644
--- a/src/map/instance.c
+++ b/src/map/instance.c
@@ -253,6 +253,34 @@ int instance_del_load(struct map_session_data* sd, va_list args)
return 1;
}
+/* for npcs behave differently when being unloaded within a instance */
+int instance_cleanup_sub(struct block_list *bl, va_list ap) {
+ nullpo_ret(bl);
+
+ switch(bl->type) {
+ case BL_PC:
+ map_quit((struct map_session_data *) bl);
+ break;
+ case BL_NPC:
+ npc_unload((struct npc_data *)bl,true);
+ break;
+ case BL_MOB:
+ unit_free(bl,CLR_OUTSIGHT);
+ break;
+ case BL_PET:
+ //There is no need for this, the pet is removed together with the player. [Skotlex]
+ break;
+ case BL_ITEM:
+ map_clearflooritem(bl->id);
+ break;
+ case BL_SKILL:
+ skill_delunit((struct skill_unit *) bl);
+ break;
+ }
+
+ return 1;
+}
+
/*--------------------------------------
* Removes a simple instance map
*--------------------------------------*/
@@ -266,7 +294,7 @@ void instance_del_map(int m)
}
map_foreachpc(instance_del_load, m);
- map_foreachinmap(cleanup_sub, m, BL_ALL);
+ map_foreachinmap(instance_cleanup_sub, m, BL_ALL);
if( map[m].mob_delete_timer != INVALID_TIMER )
delete_timer(map[m].mob_delete_timer, map_removemobs_timer);
diff --git a/src/map/npc.c b/src/map/npc.c
index 4f08d28f5..9cfce37ac 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -1739,7 +1739,7 @@ int npc_unload(struct npc_data* nd, bool single) {
npc_remove_map(nd);
map_deliddb(&nd->bl);
if( single )
- strdb_remove(npcname_db, nd->exname);
+ strdb_remove(npcname_db, nd->exname);
if (nd->chat_id) // remove npc chatroom object and kick users
chat_deletenpcchat(nd);