Issue information

Issue ID
#3956
Status
Fixed
Severity
Low
Started
Hercules Elf Bot
Dec 20, 2009 16:32
Last Post
Hercules Elf Bot
Dec 20, 2009 16:32
Confirmation
N/A

Hercules Elf Bot - Dec 20, 2009 16:32

Originally posted by [b]theultramage[/b]
http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=3956

0x106 <account id>.l <hp>.w <maxhp>.w
Displays a hp bar with these values on the character with this account id.

In clif.c, there are multiple functions which construct this packet:
- clif_party_hp (send to PARTY_AREA_WOS)
- clif_bg_hp (send to BG_AREA_WOS)
- clif_hpmeter_single (send to single fd)
- clif_hpmeter (send to all GMs in AREA)

Each of these copy-pastes the came code to construct, bounds-check and send the packet. An improvement would be to write one common function to construct the packet into a buffer, and then let the other functions just send it off wherever they want to.

An associated issue exists with clif_hpmeter. This function is called whenever someone's hp changes. If you turn on gm.conf's disp_hpmeter setting, it will produce quite significant cpu loads. This is because everytime someone's hp changes, the way it is implemented, the entire session[] array is scanned and all players' x/y/map coordinates are searched for the area around the character. This should be changed into a map_foreachinarea call instead.