From 6cec6e91de4f7490a48a5a145ab3d54efc7fc2c1 Mon Sep 17 00:00:00 2001 From: shennetsind Date: Sun, 27 Oct 2013 18:02:20 -0200 Subject: Performance Improvement: hpmeter whenever a character's hp was modified (e.g. damage/heal), clif_hpmeter would look for nearby characters with the PC_PERM_VIEW_HPMETER permission (foreachinarea operation), and since most of the time there isn't such a char nearby it would needlessly consume processing power, now hpmeter is only triggered when there are actual need (when a character with such capabilities is within the map). as little as this may look like, its a mega boost for damage-intensive areas e.g. woe, whereas a single AoE damaging 10 people would, without this, trigger foreachinarea 10 times one very hit. Signed-off-by: shennetsind --- src/map/clif.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/map/clif.c') diff --git a/src/map/clif.c b/src/map/clif.c index a051506d5..aaa321f1b 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -2916,7 +2916,8 @@ void clif_updatestatus(struct map_session_data *sd,int type) case SP_HP: WFIFOL(fd,4)=sd->battle_status.hp; // TODO: Won't these overwrite the current packet? - clif->hpmeter(sd); + if( map->list[sd->bl.m].hpmeter_visible ) + clif->hpmeter(sd); if( !battle_config.party_hp_mode && sd->status.party_id ) clif->party_hp(sd); if( sd->bg_id ) @@ -9439,6 +9440,12 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) { instance->list[map->list[sd->bl.m].instance_id].users++; instance->check_idle(map->list[sd->bl.m].instance_id); } + + if( pc->has_permission(sd,PC_PERM_VIEW_HPMETER) ) { + map->list[sd->bl.m].hpmeter_visible++; + sd->state.hpmeter_visible = 1; + } + map->iwall_get(sd); // Updates Walls Info on this Map to Client status_calc_pc(sd, false);/* some conditions are map-dependent so we must recalculate */ sd->state.changemap = false; -- cgit v1.2.3-60-g2f50