summaryrefslogtreecommitdiff
path: root/src/map/instance.c
diff options
context:
space:
mode:
authorshennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-05-26 21:49:36 +0000
committershennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-05-26 21:49:36 +0000
commit5f5cd93f2da3377ce3b9ae45d4a15a944a723517 (patch)
treedb90d3aa9e10b9b18aa5339b6c63f531ef8541fd /src/map/instance.c
parente576f13c95750f3c2b8fc3e764ab2b80f76df8b9 (diff)
downloadhercules-5f5cd93f2da3377ce3b9ae45d4a15a944a723517.tar.gz
hercules-5f5cd93f2da3377ce3b9ae45d4a15a944a723517.tar.bz2
hercules-5f5cd93f2da3377ce3b9ae45d4a15a944a723517.tar.xz
hercules-5f5cd93f2da3377ce3b9ae45d4a15a944a723517.zip
Fixed bugreport:5658 Instance NPCs will now be cleared properly. Super-Special Thanks to Pig321
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16153 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/instance.c')
-rw-r--r--src/map/instance.c30
1 files changed, 29 insertions, 1 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);