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; } }