[Cleanup] Fix check for !this in Client::SendHPUpdateMarquee() (#3257)

# Notes
- `!this` isn't valid, as `this` can never be nullptr.
This commit is contained in:
Alex King 2023-04-05 10:13:24 -04:00 committed by GitHub
parent d33cfad567
commit 81314a3315
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8650,15 +8650,17 @@ void Client::RewardFaction(int id, int amount)
}
void Client::SendHPUpdateMarquee(){
if (!this || !IsClient() || !current_hp || !max_hp)
if (!IsClient() || !current_hp || !max_hp) {
return;
}
/* Health Update Marquee Display: Custom*/
uint8 health_percentage = (uint8)(current_hp * 100 / max_hp);
if (health_percentage >= 100)
const auto health_percentage = static_cast<uint8>(current_hp * 100 / max_hp);
if (health_percentage >= 100) {
return;
}
std::string health_update_notification = StringFormat("Health: %u%%", health_percentage);
const auto health_update_notification = fmt::format("Health: {}%%", health_percentage);
SendMarqueeMessage(Chat::Yellow, 510, 0, 3000, 3000, health_update_notification);
}