1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-06 06:32:56 +01:00

Use finance_check_affordability instead of CheckActionAffordability

This commit is contained in:
Matt
2019-02-10 23:11:12 +01:00
parent 914bf3a0c6
commit 21e4c52853

View File

@@ -126,17 +126,6 @@ namespace GameActions
return false;
}
static bool CheckActionAffordability(const GameActionResult* result)
{
if (gParkFlags & PARK_FLAGS_NO_MONEY)
return true;
if (result->Cost <= 0)
return true;
if (result->Cost <= gCash)
return true;
return false;
}
static GameActionResult::Ptr QueryInternal(const GameAction* action, bool topLevel)
{
Guard::ArgumentNotNull(action);
@@ -165,7 +154,7 @@ namespace GameActions
if (result->Error == GA_ERROR::OK)
{
if (!CheckActionAffordability(result.get()))
if (finance_check_affordability(result->Cost, action->GetFlags()))
{
result->Error = GA_ERROR::INSUFFICIENT_FUNDS;
result->ErrorMessage = STR_NOT_ENOUGH_CASH_REQUIRES;
@@ -309,8 +298,7 @@ namespace GameActions
gCommandPosition.z = result->Position.z;
// Update money balance
if (!(gParkFlags & PARK_FLAGS_NO_MONEY) && !(flags & GAME_COMMAND_FLAG_GHOST) && !(flags & GAME_COMMAND_FLAG_5)
&& result->Cost != 0)
if (finance_check_money_required(flags) && result->Cost != 0)
{
finance_payment(result->Cost, result->ExpenditureType);
money_effect_create(result->Cost);