Minor cleanups
* Changed to pass by reference. * Expanded for loop to uint16 for DAMAGELOG_SIZE.
This commit is contained in:
parent
eea68c2559
commit
d266c1f477
@ -1043,21 +1043,18 @@ static int clif_setlevel(struct block_list* bl) {
|
|||||||
* @param tbl: Mob to check
|
* @param tbl: Mob to check
|
||||||
* @return True if the HP bar should be displayed or false otherwise
|
* @return True if the HP bar should be displayed or false otherwise
|
||||||
*/
|
*/
|
||||||
static bool clif_mob_damaged_hpbar(block_list *bl, block_list *tbl) {
|
static bool clif_mob_damaged_hpbar(block_list &bl, block_list &tbl) {
|
||||||
if (bl == nullptr || tbl == nullptr)
|
mob_data *md = BL_CAST(BL_MOB, &tbl);
|
||||||
return false;
|
|
||||||
|
|
||||||
mob_data *md = BL_CAST(BL_MOB, tbl);
|
|
||||||
|
|
||||||
if (md == nullptr)
|
if (md == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
map_session_data *sd = BL_CAST(BL_PC, bl);
|
map_session_data *sd = BL_CAST(BL_PC, &bl);
|
||||||
|
|
||||||
if (sd == nullptr)
|
if (sd == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (uint8 i = 0; i < DAMAGELOG_SIZE; i++) { // Must show hp bar to all char who already hit the mob.
|
for (uint16 i = 0; i < DAMAGELOG_SIZE; i++) { // Must show hp bar to all char who already hit the mob.
|
||||||
if (md->dmglog[i].id == sd->status.char_id)
|
if (md->dmglog[i].id == sd->status.char_id)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1193,7 +1190,7 @@ static void clif_set_unit_idle( struct block_list* bl, bool walking, send_target
|
|||||||
#endif
|
#endif
|
||||||
#if PACKETVER >= 20120221
|
#if PACKETVER >= 20120221
|
||||||
if( battle_config.monster_hp_bars_info && bl->type == BL_MOB && tbl->type == BL_PC && !map_getmapflag( bl->m, MF_HIDEMOBHPBAR ) && ( status_get_hp( bl ) < status_get_max_hp( bl ) ) ){
|
if( battle_config.monster_hp_bars_info && bl->type == BL_MOB && tbl->type == BL_PC && !map_getmapflag( bl->m, MF_HIDEMOBHPBAR ) && ( status_get_hp( bl ) < status_get_max_hp( bl ) ) ){
|
||||||
if (clif_mob_damaged_hpbar(tbl, bl)) { // Must show hp bar to all char who already hit the mob.
|
if (clif_mob_damaged_hpbar(*tbl, *bl)) { // Must show hp bar to all char who already hit the mob.
|
||||||
p.maxHP = status_get_max_hp(bl);
|
p.maxHP = status_get_max_hp(bl);
|
||||||
p.HP = status_get_hp(bl);
|
p.HP = status_get_hp(bl);
|
||||||
} else { // Player didn't attack the mob.
|
} else { // Player didn't attack the mob.
|
||||||
@ -1339,7 +1336,7 @@ static void clif_spawn_unit( struct block_list *bl, enum send_target target ){
|
|||||||
#endif
|
#endif
|
||||||
#if PACKETVER >= 20120221
|
#if PACKETVER >= 20120221
|
||||||
if( battle_config.monster_hp_bars_info && bl->type == BL_MOB && !map_getmapflag( bl->m, MF_HIDEMOBHPBAR ) && ( status_get_hp( bl ) < status_get_max_hp( bl ) ) ){
|
if( battle_config.monster_hp_bars_info && bl->type == BL_MOB && !map_getmapflag( bl->m, MF_HIDEMOBHPBAR ) && ( status_get_hp( bl ) < status_get_max_hp( bl ) ) ){
|
||||||
if (clif_mob_damaged_hpbar(bl, bl)) { // Must show hp bar to all char who already hit the mob.
|
if (clif_mob_damaged_hpbar(*bl, *bl)) { // Must show hp bar to all char who already hit the mob.
|
||||||
p.maxHP = status_get_max_hp(bl);
|
p.maxHP = status_get_max_hp(bl);
|
||||||
p.HP = status_get_hp(bl);
|
p.HP = status_get_hp(bl);
|
||||||
} else { // Player didn't attack the mob.
|
} else { // Player didn't attack the mob.
|
||||||
@ -1452,7 +1449,7 @@ static void clif_set_unit_walking( struct block_list *bl, struct map_session_dat
|
|||||||
#endif
|
#endif
|
||||||
#if PACKETVER >= 20120221
|
#if PACKETVER >= 20120221
|
||||||
if( battle_config.monster_hp_bars_info && bl->type == BL_MOB && tsd != nullptr && !map_getmapflag(bl->m, MF_HIDEMOBHPBAR) && (status_get_hp(bl) < status_get_max_hp( bl ) ) ){
|
if( battle_config.monster_hp_bars_info && bl->type == BL_MOB && tsd != nullptr && !map_getmapflag(bl->m, MF_HIDEMOBHPBAR) && (status_get_hp(bl) < status_get_max_hp( bl ) ) ){
|
||||||
if (clif_mob_damaged_hpbar(&tsd->bl, bl)) { // Must show hp bar to all char who already hit the mob.
|
if (clif_mob_damaged_hpbar(tsd->bl, *bl)) { // Must show hp bar to all char who already hit the mob.
|
||||||
p.maxHP = status_get_max_hp(bl);
|
p.maxHP = status_get_max_hp(bl);
|
||||||
p.HP = status_get_hp(bl);
|
p.HP = status_get_hp(bl);
|
||||||
} else { // Player didn't attack the mob.
|
} else { // Player didn't attack the mob.
|
||||||
@ -4846,7 +4843,7 @@ void clif_getareachar_unit( struct map_session_data* sd,struct block_list *bl ){
|
|||||||
clif_specialeffect_single(bl,EF_BABYBODY2,sd->fd);
|
clif_specialeffect_single(bl,EF_BABYBODY2,sd->fd);
|
||||||
#if PACKETVER >= 20120404
|
#if PACKETVER >= 20120404
|
||||||
if (battle_config.monster_hp_bars_info && !map_getmapflag(bl->m, MF_HIDEMOBHPBAR)) {
|
if (battle_config.monster_hp_bars_info && !map_getmapflag(bl->m, MF_HIDEMOBHPBAR)) {
|
||||||
for (uint8 i = 0; i < DAMAGELOG_SIZE; i++) // Must show hp bar to all char who already hit the mob.
|
for (uint16 i = 0; i < DAMAGELOG_SIZE; i++) // Must show hp bar to all char who already hit the mob.
|
||||||
if( md->dmglog[i].id == sd->status.char_id )
|
if( md->dmglog[i].id == sd->status.char_id )
|
||||||
clif_monster_hp_bar(md, sd->fd);
|
clif_monster_hp_bar(md, sd->fd);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user