diff options
author | shennetsind <ind@henn.et> | 2013-12-17 23:02:13 -0200 |
---|---|---|
committer | shennetsind <ind@henn.et> | 2013-12-17 23:02:13 -0200 |
commit | 38f6b2c68c59d3ed2e3fc6d4d75907939c4fdf61 (patch) | |
tree | 45b4bf49bca0ffb5fabe7405f445caa22cc215f8 /src/map/skill.c | |
parent | 46a990697bdacaf3955c54e0b9d8503f3b704728 (diff) | |
download | hercules-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/skill.c')
-rw-r--r-- | src/map/skill.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/map/skill.c b/src/map/skill.c index 6893a9f57..71e343db0 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -17141,10 +17141,7 @@ int skill_blockpc_start_(struct map_session_data *sd, uint16 skill_id, int tick) if( !(cd = idb_get(skill->cd_db,sd->status.char_id)) ) {// create a new skill cooldown object for map storage cd = ers_alloc(skill->cd_ers, struct skill_cd); - - cd->cursor = 0; - memset(cd->entry, 0, sizeof(cd->entry)); - + idb_put( skill->cd_db, sd->status.char_id, cd ); } else { int i; @@ -18215,9 +18212,9 @@ int do_init_skill(bool minimal) { skill->cd_db = idb_alloc(DB_OPT_BASE); skill->usave_db = idb_alloc(DB_OPT_RELEASE_DATA); - skill->unit_ers = ers_new(sizeof(struct skill_unit_group),"skill.c::skill_unit_ers",ERS_OPT_NONE); + skill->unit_ers = ers_new(sizeof(struct skill_unit_group),"skill.c::skill_unit_ers",ERS_OPT_CLEAN); skill->timer_ers = ers_new(sizeof(struct skill_timerskill),"skill.c::skill_timer_ers",ERS_OPT_NONE); - skill->cd_ers = ers_new(sizeof(struct skill_cd),"skill.c::skill_cd_ers",ERS_OPT_CLEAR); + skill->cd_ers = ers_new(sizeof(struct skill_cd),"skill.c::skill_cd_ers",ERS_OPT_CLEAR|ERS_OPT_CLEAN); skill->cd_entry_ers = ers_new(sizeof(struct skill_cd_entry),"skill.c::skill_cd_entry_ers",ERS_OPT_CLEAR); ers_chunk_size(skill->cd_ers, 25); |