summaryrefslogtreecommitdiff
path: root/src/map/map.c
diff options
context:
space:
mode:
authorshennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-11-10 17:15:37 +0000
committershennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-11-10 17:15:37 +0000
commitcb03e17fdc83704678b67e20453511d3f2c41d64 (patch)
tree5d1289e986c73f95dc06ee3e49f675e72a7f93f8 /src/map/map.c
parent4b2f3fcbde7d956c0a4f0f7ebfdb9c9ac1167c18 (diff)
downloadhercules-cb03e17fdc83704678b67e20453511d3f2c41d64.tar.gz
hercules-cb03e17fdc83704678b67e20453511d3f2c41d64.tar.bz2
hercules-cb03e17fdc83704678b67e20453511d3f2c41d64.tar.xz
hercules-cb03e17fdc83704678b67e20453511d3f2c41d64.zip
Performance Improvement; Server shut down, instance clear up, and @cleanmap are now all faster. Instead of wasting time doing a dbmap lookup (of a data it already possessed!) on each floor item being deleted, it'll use the data to clean the item.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16901 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/map.c')
-rw-r--r--src/map/map.c22
1 files changed, 17 insertions, 5 deletions
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);