From e84811bdcee9218b4c88c5ad6a3a4e63298cebcf Mon Sep 17 00:00:00 2001 From: EmosewaMC <39972741+EmosewaMC@users.noreply.github.com> Date: Thu, 23 Dec 2021 18:49:01 -0800 Subject: [PATCH] Refactored if statement for coins Refactored the if statement for coins so there is only one SetCoins call for the function. --- dGame/dMission/Mission.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/dGame/dMission/Mission.cpp b/dGame/dMission/Mission.cpp index 1d5ab4a0..ac503b51 100644 --- a/dGame/dMission/Mission.cpp +++ b/dGame/dMission/Mission.cpp @@ -453,7 +453,7 @@ void Mission::YieldRewards() { } if (info->reward_currency_repeatable > 0) { - character->SetCoins(character->GetCoins() + info->reward_currency_repeatable, COIN_SOURCE_MISSION); + character->SetCoins(character->GetCoins() + info->reward_currency_repeatable, LOOT_SOURCE_MISSION); } return; @@ -480,11 +480,15 @@ void Mission::YieldRewards() { inventoryComponent->AddItem(pair.first, count); } - - if (info->reward_currency > 0 && info->isMission) { - character->SetCoins(character->GetCoins() + info->reward_currency, COIN_SOURCE_MISSION); - } else if (info->reward_currency && !info->isMission) { - character->SetCoins(character->GetCoins() + info->reward_currency, COIN_SOURCE_ACHIEVEMENT); + + int32_t lootSource = LOOT_SOURCE_NONE; + if (info->reward_currency > 0) { + if(info->isMission) { + lootSource = LOOT_SOURCE_MISSION; + } else { + lootSource = LOOT_SOURCE_ACHIEVEMENT; + } + character->SetCoins(character->GetCoins() + info->reward_currency, lootSource); } if (info->reward_maxinventory > 0) {