Replace two casts with one

This commit is contained in:
Jett 2021-12-11 14:22:39 +00:00
parent 22de531ab3
commit 6427b097ab

View File

@ -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<Player*>(this)->GetDroppedCoins();
auto * player = static_cast<Player*>(this);
auto droppedcoins = player->GetDroppedCoins();
if (count > droppedcoins) {
return false;
} else {
static_cast<Player*>(this)->SetDroppedCoins(droppedcoins - count);
player->SetDroppedCoins(droppedcoins - count);
return true;
}
}