diff options
author | celest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2005-04-07 15:14:35 +0000 |
---|---|---|
committer | celest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2005-04-07 15:14:35 +0000 |
commit | a6cd6538e4271ea08dc86803e8b7e8c8f235960b (patch) | |
tree | 883d4c1ae282fb67e1720f81c20f564499298ff4 /src/map/mob.c | |
parent | be2871f1e62bbb88c7fd413456d1b9c39d1f2fd9 (diff) | |
download | hercules-a6cd6538e4271ea08dc86803e8b7e8c8f235960b.tar.gz hercules-a6cd6538e4271ea08dc86803e8b7e8c8f235960b.tar.bz2 hercules-a6cd6538e4271ea08dc86803e8b7e8c8f235960b.tar.xz hercules-a6cd6538e4271ea08dc86803e8b7e8c8f235960b.zip |
* Readded @disablenpc
* Fixed @reloadscript not removing old NPC's and monsters first
* Some changes in mob and NPC unloading
* Changed the original @disablenpc to @hidenpc
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1429 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/mob.c')
-rw-r--r-- | src/map/mob.c | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/src/map/mob.c b/src/map/mob.c index cd096cabd..f076b7530 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -914,7 +914,8 @@ int mob_spawn(int id) struct mob_data *md; struct block_list *bl; - nullpo_retr(-1, bl=map_id2bl(id)); + //nullpo_retr(-1, bl=map_id2bl(id)); + bl=map_id2bl(id); if(!bl || !bl->type || bl->type!=BL_MOB) return -1; @@ -2106,42 +2107,49 @@ static int mob_delay_item_drop2(int tid,unsigned int tick,int id,int data) * mob data is erased. *------------------------------------------ */ -int mob_delete(struct mob_data *md) +void mob_unload(struct mob_data *md) +{ + nullpo_retv(md); + mob_remove_map(md, 0); + map_deliddb(&md->bl); + aFree(md); + md = NULL; +} +int mob_remove_map(struct mob_data *md, int type) { nullpo_retr(1, md); if(md->bl.prev == NULL) return 1; mob_changestate(md,MS_DEAD,0); - clif_clearchar_area(&md->bl,1); + clif_clearchar_area(&md->bl,type); map_delblock(&md->bl); - if(mob_get_viewclass(md->class_) <= 1000) - clif_clearchar_delay(gettick()+3000,&md->bl,0); - mob_deleteslave(md); - mob_setdelayspawn(md->bl.id); + if (md->lootitem){ + aFree(md->lootitem); + md->lootitem = NULL; + } + return 0; } - -int mob_catch_delete(struct mob_data *md,int type) +int mob_delete(struct mob_data *md) { nullpo_retr(1, md); - if(md->bl.prev == NULL) - return 1; - mob_changestate(md,MS_DEAD,0); - clif_clearchar_area(&md->bl,type); - map_delblock(&md->bl); + mob_remove_map(md, 1); + if (mob_get_viewclass(md->class_) <= 1000) + clif_clearchar_delay(gettick()+3000,&md->bl,0); + mob_deleteslave(md); mob_setdelayspawn(md->bl.id); return 0; } - int mob_timer_delete(int tid, unsigned int tick, int id, int data) { struct mob_data *md=(struct mob_data *)map_id2bl(id); nullpo_retr(0, md); //for Alchemist CANNIBALIZE [Lupus] - mob_catch_delete(md,3); + mob_remove_map(md, 3); + mob_setdelayspawn(md->bl.id); return 0; } |