summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/map/atcommand.c2
-rw-r--r--src/map/instance.c2
-rw-r--r--src/map/map.c22
-rw-r--r--src/map/map.h2
-rw-r--r--src/map/mob.c2
-rw-r--r--src/map/pc.c2
-rw-r--r--src/map/pet.c2
7 files changed, 23 insertions, 11 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index b7b59940e..ab7e41c3f 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -6156,7 +6156,7 @@ ACMD_FUNC(mobsearch)
static int atcommand_cleanmap_sub(struct block_list *bl, va_list ap)
{
nullpo_ret(bl);
- map_clearflooritem(bl->id);
+ map_clearflooritem(bl);
return 0;
}
diff --git a/src/map/instance.c b/src/map/instance.c
index 9d0b8246e..f5ae125a6 100644
--- a/src/map/instance.c
+++ b/src/map/instance.c
@@ -271,7 +271,7 @@ int instance_cleanup_sub(struct block_list *bl, va_list ap) {
//There is no need for this, the pet is removed together with the player. [Skotlex]
break;
case BL_ITEM:
- map_clearflooritem(bl->id);
+ map_clearflooritem(bl);
break;
case BL_SKILL:
skill_delunit((struct skill_unit *) bl);
diff --git a/src/map/map.c b/src/map/map.c
index 880428084..61ac0ef0c 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -1302,14 +1302,11 @@ int map_clearflooritem_timer(int tid, unsigned int tick, int id, intptr_t data)
{
struct flooritem_data* fitem = (struct flooritem_data*)idb_get(id_db, id);
- if (fitem == NULL || fitem->bl.type != BL_ITEM || (!data && fitem->cleartimer != tid))
- {
+ if (fitem == NULL || fitem->bl.type != BL_ITEM || (fitem->cleartimer != tid)) {
ShowError("map_clearflooritem_timer : error\n");
return 1;
}
- if (data)
- delete_timer(fitem->cleartimer,map_clearflooritem_timer);
if (search_petDB_index(fitem->item_data.nameid, PET_EGG) >= 0)
intif_delete_petdata(MakeDWord(fitem->item_data.card[1], fitem->item_data.card[2]));
@@ -1321,6 +1318,21 @@ int map_clearflooritem_timer(int tid, unsigned int tick, int id, intptr_t data)
return 0;
}
+/*
+ * clears a single bl item out of the bazooonga.
+ */
+void map_clearflooritem(struct block_list *bl) {
+ struct flooritem_data* fitem = (struct flooritem_data*)bl;
+
+ if( fitem->cleartimer )
+ delete_timer(fitem->cleartimer,map_clearflooritem_timer);
+
+ clif_clearflooritem(fitem, 0);
+ map_deliddb(&fitem->bl);
+ map_delblock(&fitem->bl);
+ map_freeblock(&fitem->bl);
+}
+
/*==========================================
* (m,x,y) locates a random available free cell around the given coordinates
* to place an BL_ITEM object. Scan area is 9x9, returns 1 on success.
@@ -3550,7 +3562,7 @@ int cleanup_sub(struct block_list *bl, va_list ap)
//There is no need for this, the pet is removed together with the player. [Skotlex]
break;
case BL_ITEM:
- map_clearflooritem(bl->id);
+ map_clearflooritem(bl);
break;
case BL_SKILL:
skill_delunit((struct skill_unit *) bl);
diff --git a/src/map/map.h b/src/map/map.h
index f46a28ca4..43bef63af 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -658,7 +658,7 @@ bool map_addnpc(int,struct npc_data *);
// map item
int map_clearflooritem_timer(int tid, unsigned int tick, int id, intptr_t data);
int map_removemobs_timer(int tid, unsigned int tick, int id, intptr_t data);
-#define map_clearflooritem(id) map_clearflooritem_timer(0,0,id,1)
+void map_clearflooritem(struct block_list* bl);
int map_addflooritem(struct item *item_data,int amount,int m,int x,int y,int first_charid,int second_charid,int third_charid,int flags);
// player to map session
diff --git a/src/map/mob.c b/src/map/mob.c
index 50a9397da..3c485ee58 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -1629,7 +1629,7 @@ static bool mob_ai_sub_hard(struct mob_data *md, unsigned int tick)
unit_set_walkdelay(&md->bl, tick, md->status.amotion, 1);
}
//Clear item.
- map_clearflooritem (tbl->id);
+ map_clearflooritem (tbl);
mob_unlocktarget (md,tick);
return true;
}
diff --git a/src/map/pc.c b/src/map/pc.c
index ed5bf8aaa..723b2df7b 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -3977,7 +3977,7 @@ int pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem)
//Display pickup animation.
pc_stop_attack(sd);
clif_takeitem(&sd->bl,&fitem->bl);
- map_clearflooritem(fitem->bl.id);
+ map_clearflooritem(&fitem->bl);
return 1;
}
diff --git a/src/map/pet.c b/src/map/pet.c
index 3513ece86..5c7f15151 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -922,7 +922,7 @@ static int pet_ai_sub_hard(struct pet_data *pd, struct map_session_data *sd, uns
if(pd->loot->count < pd->loot->max){
memcpy(&pd->loot->item[pd->loot->count++],&fitem->item_data,sizeof(pd->loot->item[0]));
pd->loot->weight += itemdb_weight(fitem->item_data.nameid)*fitem->item_data.amount;
- map_clearflooritem(target->id);
+ map_clearflooritem(target);
}
//Target is unlocked regardless of whether it was picked or not.
pet_unlocktarget(pd);