From 81314a3315113e36cb6abaff41aede6656ae12a6 Mon Sep 17 00:00:00 2001 From: Alex King <89047260+Kinglykrab@users.noreply.github.com> Date: Wed, 5 Apr 2023 10:13:24 -0400 Subject: [PATCH] [Cleanup] Fix check for !this in Client::SendHPUpdateMarquee() (#3257) # Notes - `!this` isn't valid, as `this` can never be nullptr. --- zone/client.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index 6d999e867..070567e22 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -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(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); }