From 6427b097ab9415e32d69768e519a777bc8f7679a Mon Sep 17 00:00:00 2001 From: Jett <55758076+Jettford@users.noreply.github.com> Date: Sat, 11 Dec 2021 14:22:39 +0000 Subject: [PATCH] Replace two casts with one --- dGame/Entity.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dGame/Entity.cpp b/dGame/Entity.cpp index 089452ae..0579035e 100644 --- a/dGame/Entity.cpp +++ b/dGame/Entity.cpp @@ -1646,11 +1646,12 @@ void Entity::PickupItem(const LWOOBJID& objectID) { bool Entity::CanPickupCoins(uint64_t count) { // bool because we are returning whether they can pick up the coins if (!IsPlayer()) return false; - auto droppedcoins = static_cast(this)->GetDroppedCoins(); + auto * player = static_cast(this); + auto droppedcoins = player->GetDroppedCoins(); if (count > droppedcoins) { return false; } else { - static_cast(this)->SetDroppedCoins(droppedcoins - count); + player->SetDroppedCoins(droppedcoins - count); return true; } }