diff options
-rw-r--r-- | src/map/clif.c | 9 | ||||
-rw-r--r-- | src/map/map.h | 3 | ||||
-rw-r--r-- | src/map/pc.h | 3 | ||||
-rw-r--r-- | src/map/unit.c | 4 |
4 files changed, 17 insertions, 2 deletions
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; diff --git a/src/map/map.h b/src/map/map.h index c8b043acb..6b7d2a630 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -706,6 +706,9 @@ struct map_data { /* ShowEvent Data Cache */ struct questinfo *qi_data; unsigned short qi_count; + + /* speeds up clif_updatestatus processing by causing hpmeter to run only when someone with the permission can view it */ + unsigned short hpmeter_visible; }; /// Stores information about a remote map (for multi-mapserver setups). diff --git a/src/map/pc.h b/src/map/pc.h index 32c1e4ee0..fdcf395a7 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -177,6 +177,7 @@ struct map_session_data { unsigned int workinprogress : 3; // 1 = disable skill/item, 2 = disable npc interaction, 3 = disable both unsigned int hold_recalc : 1; unsigned int snovice_call_flag : 3; //Summon Angel (stage 1~3) + unsigned int hpmeter_visible : 1; } state; struct { unsigned char no_weapon_damage, no_magic_damage, no_misc_damage; @@ -545,7 +546,7 @@ enum equip_pos { EQP_COSTUME_HEAD_TOP = 0x000400, //1024 EQP_COSTUME_HEAD_MID = 0x000800, //2048 EQP_COSTUME_HEAD_LOW = 0x001000, //4096 - EQP_COSTUME_GARMENT = 0x002000, //8192 + EQP_COSTUME_GARMENT = 0x002000, //8192 //UNUSED_COSTUME_FLOOR = 0x004000, //16384 EQP_AMMO = 0x008000, //32768 EQP_SHADOW_ARMOR = 0x010000, //65536 diff --git a/src/map/unit.c b/src/map/unit.c index 7b4ac2c50..08e97cfee 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -2194,6 +2194,10 @@ int unit_remove_map(struct block_list *bl, clr_type clrtype, const char* file, i instance->list[map->list[bl->m].instance_id].users--; instance->check_idle(map->list[bl->m].instance_id); } + if( sd->state.hpmeter_visible ) { + map->list[bl->m].hpmeter_visible--; + sd->state.hpmeter_visible = 0; + } sd->state.debug_remove_map = 1; // temporary state to track double remove_map's [FlavioJS] sd->debug_file = file; sd->debug_line = line; |