From 38f6b2c68c59d3ed2e3fc6d4d75907939c4fdf61 Mon Sep 17 00:00:00 2001 From: shennetsind Date: Tue, 17 Dec 2013 23:02:13 -0200 Subject: Speed up of several procedures that rely on ERS, _mreallocz ('z'ero) Made Possible Thanks to the Woonderful Haruna! <3 Commit also fixes an inconsistency in the ERS, where it'd start with clear memory but would use garbage upon resizing, also implements a new ERS option that clears entries as soon as pass by ers_free, so that they'll be all shinny for when ers_alloc reuses them. Signed-off-by: shennetsind --- src/map/mob.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/map/mob.c') diff --git a/src/map/mob.c b/src/map/mob.c index 90a967d61..d919e7478 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -1768,7 +1768,6 @@ int mob_ai_hard(int tid, int64 tick, int id, intptr_t data) { *------------------------------------------*/ struct item_drop* mob_setdropitem(int nameid, int qty, struct item_data *data) { struct item_drop *drop = ers_alloc(item_drop_ers, struct item_drop); - memset(&drop->item_data, 0, sizeof(struct item)); drop->item_data.nameid = nameid; drop->item_data.amount = qty; drop->item_data.identify = data ? itemdb->isidentified2(data) : itemdb->isidentified(nameid); @@ -4642,7 +4641,7 @@ int do_init_mob(bool minimal) { memset(mob->db_data,0,sizeof(mob->db_data)); //Clear the array mob->db_data[0] = (struct mob_db*)aCalloc(1, sizeof (struct mob_db)); //This mob is used for random spawns mob->makedummymobdb(0); //The first time this is invoked, it creates the dummy mob - item_drop_ers = ers_new(sizeof(struct item_drop),"mob.c::item_drop_ers",ERS_OPT_NONE); + item_drop_ers = ers_new(sizeof(struct item_drop),"mob.c::item_drop_ers",ERS_OPT_CLEAN); item_drop_list_ers = ers_new(sizeof(struct item_drop_list),"mob.c::item_drop_list_ers",ERS_OPT_NONE); mob->load(minimal); -- cgit v1.2.3-60-g2f50