summaryrefslogtreecommitdiff
path: root/src/map/map.c
diff options
context:
space:
mode:
authorFate <fate-tmw@googlemail.com>2009-06-17 19:37:01 +0000
committerFate <fate-tmw@googlemail.com>2009-06-17 19:37:01 +0000
commit65e4adfc4f90aa087b7cde089029636257761a36 (patch)
tree79796c7ff6ff92712c8b5c028d4c2347f7407314 /src/map/map.c
parent7fcff757d7896c321a3ae5c6c4c4195031265b43 (diff)
downloadtmwa-65e4adfc4f90aa087b7cde089029636257761a36.tar.gz
tmwa-65e4adfc4f90aa087b7cde089029636257761a36.tar.bz2
tmwa-65e4adfc4f90aa087b7cde089029636257761a36.tar.xz
tmwa-65e4adfc4f90aa087b7cde089029636257761a36.zip
Added extra checks to ensure spell invocations aren't incorrectly deleted
Diffstat (limited to 'src/map/map.c')
-rw-r--r--src/map/map.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/map/map.c b/src/map/map.c
index 128d50b..1acae20 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -575,10 +575,15 @@ int map_addobject(struct block_list *bl) {
* map_delobjectのfreeしないバージョン
*------------------------------------------
*/
-int map_delobjectnofree(int id) {
+int map_delobjectnofree(int id, int type) {
if(object[id]==NULL)
return 0;
+ if (object[id]->type != type) {
+ fprintf(stderr, "Incorrect type: expected %d, got %d\n", type, object[id]->type);
+ *((char *) 0) = 0; // break for backtrace
+ }
+
map_delblock(object[id]);
numdb_erase(id_db,id);
// map_freeblock(object[id]);
@@ -601,13 +606,13 @@ int map_delobjectnofree(int id) {
* addとの対称性が無いのが気になる
*------------------------------------------
*/
-int map_delobject(int id) {
+int map_delobject(int id, int type) {
struct block_list *obj = object[id];
if(obj==NULL)
return 0;
- map_delobjectnofree(id);
+ map_delobjectnofree(id, type);
if (obj->type == BL_PC) // [Fate] Not sure where else to put this... I'm not sure where delobject for PCs is called from
pc_cleanup((struct map_session_data *)obj);
@@ -675,7 +680,7 @@ int map_clearflooritem_timer(int tid,unsigned int tick,int id,int data) {
if(data)
delete_timer(fitem->cleartimer,map_clearflooritem_timer);
clif_clearflooritem(fitem,0);
- map_delobject(fitem->bl.id);
+ map_delobject(fitem->bl.id, BL_ITEM);
return 0;
}
@@ -1752,6 +1757,9 @@ static int cleanup_sub(struct block_list *bl, va_list ap) {
case BL_SKILL:
skill_delunit((struct skill_unit *) bl);
break;
+ case BL_SPELL:
+ spell_free_invocation((struct invocation *) bl);
+ break;
}
return 0;