summaryrefslogtreecommitdiff
path: root/src/map/mob.c
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-12-17 23:02:13 -0200
committershennetsind <ind@henn.et>2013-12-17 23:02:13 -0200
commit38f6b2c68c59d3ed2e3fc6d4d75907939c4fdf61 (patch)
tree45b4bf49bca0ffb5fabe7405f445caa22cc215f8 /src/map/mob.c
parent46a990697bdacaf3955c54e0b9d8503f3b704728 (diff)
downloadhercules-38f6b2c68c59d3ed2e3fc6d4d75907939c4fdf61.tar.gz
hercules-38f6b2c68c59d3ed2e3fc6d4d75907939c4fdf61.tar.bz2
hercules-38f6b2c68c59d3ed2e3fc6d4d75907939c4fdf61.tar.xz
hercules-38f6b2c68c59d3ed2e3fc6d4d75907939c4fdf61.zip
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 <ind@henn.et>
Diffstat (limited to 'src/map/mob.c')
-rw-r--r--src/map/mob.c3
1 files changed, 1 insertions, 2 deletions
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);