summaryrefslogtreecommitdiff
path: root/src/map/mob.c
diff options
context:
space:
mode:
authorFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-02-23 16:36:58 +0000
committerFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-02-23 16:36:58 +0000
commitc2e7fc730554fc9dcd572969a4c1d0e0910ac846 (patch)
tree4ac9b9d74e65e1e2d583c4122b5b27969a4bcb0e /src/map/mob.c
parent84b6b31d41b988d8f797126474bfcbb54b198545 (diff)
downloadhercules-c2e7fc730554fc9dcd572969a4c1d0e0910ac846.tar.gz
hercules-c2e7fc730554fc9dcd572969a4c1d0e0910ac846.tar.bz2
hercules-c2e7fc730554fc9dcd572969a4c1d0e0910ac846.tar.xz
hercules-c2e7fc730554fc9dcd572969a4c1d0e0910ac846.zip
* Made mob_timer_delete check the deletetimer in the mob.
* Added missing delete_timer's every time deletetimer is being set. (except when allocating) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13544 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/mob.c')
-rw-r--r--src/map/mob.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index e69f504e3..2691dc45f 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -1705,13 +1705,20 @@ static void mob_item_drop(struct mob_data *md, struct item_drop_list *dlist, str
int mob_timer_delete(int tid, unsigned int tick, int id, intptr data)
{
- struct block_list *bl=map_id2bl(id);
- nullpo_retr(0, bl);
- if (bl->type != BL_MOB)
- return 0; //??
- //for Alchemist CANNIBALIZE [Lupus]
- ((TBL_MOB*)bl)->deletetimer = INVALID_TIMER;
- unit_free(bl,3);
+ struct block_list* bl = map_id2bl(id);
+ struct mob_data* md = BL_CAST(BL_MOB, bl);
+
+ if( md )
+ {
+ if( md->deletetimer != tid )
+ {
+ ShowError("mob_timer_delete: Timer mismatch: %d != %d\n", tid, md->deletetimer);
+ return 0;
+ }
+ //for Alchemist CANNIBALIZE [Lupus]
+ md->deletetimer = INVALID_TIMER;
+ unit_free(bl, 3);
+ }
return 0;
}
@@ -3227,7 +3234,11 @@ int mob_clone_spawn(struct map_session_data *sd, int m, int x, int y, const char
if (master_id) //Attach to Master
md->master_id = master_id;
if (duration) //Auto Delete after a while.
+ {
+ if( md->deletetimer != INVALID_TIMER )
+ delete_timer(md->deletetimer, mob_timer_delete);
md->deletetimer = add_timer (gettick() + duration, mob_timer_delete, md->bl.id, 0);
+ }
}
mob_spawn(md);