From 2a8481bd4835eba475b9e9b77402caf44201ec19 Mon Sep 17 00:00:00 2001 From: wolfreak99 Date: Thu, 23 Feb 2017 09:24:00 -0500 Subject: [PATCH] Sync "Raise / lower interest rate" --- src/openrct2/editor.c | 3 +- .../windows/editor_scenario_options.c | 40 +++++++++++++++++-- 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/src/openrct2/editor.c b/src/openrct2/editor.c index 485bb25c3d..02adf6c0e8 100644 --- a/src/openrct2/editor.c +++ b/src/openrct2/editor.c @@ -582,7 +582,8 @@ void game_command_edit_scenario_options(sint32* eax, sint32* ebx, sint32* ecx, s window_invalidate_by_class(WC_FINANCES); break; case EDIT_SCENARIOOPTIONS_SETANNUALINTERESTRATE: - + gBankLoanInterestRate = max(0, min(80, *edx)); + window_invalidate_by_class(WC_FINANCES); break; case EDIT_SCENARIOOPTIONS_SETFORBIDMARKETINGCAMPAIGNS: diff --git a/src/openrct2/windows/editor_scenario_options.c b/src/openrct2/windows/editor_scenario_options.c index f1f146f15b..cad7f75f0d 100644 --- a/src/openrct2/windows/editor_scenario_options.c +++ b/src/openrct2/windows/editor_scenario_options.c @@ -633,9 +633,25 @@ static void window_editor_scenario_options_financial_mousedown(sint32 widgetInde case WIDX_INTEREST_RATE_INCREASE: if (gBankLoanInterestRate < 80) { if (gBankLoanInterestRate < 0) { - gBankLoanInterestRate = 0; + game_do_command( + 0, + GAME_COMMAND_FLAG_APPLY, + EDIT_SCENARIOOPTIONS_SETANNUALINTERESTRATE, + 0, + GAME_COMMAND_EDIT_SCENARIO_OPTIONS, + 0, + 0 + ); } else { - gBankLoanInterestRate++; + game_do_command( + 0, + GAME_COMMAND_FLAG_APPLY, + EDIT_SCENARIOOPTIONS_SETANNUALINTERESTRATE, + gBankLoanInterestRate + 1, + GAME_COMMAND_EDIT_SCENARIO_OPTIONS, + 0, + 0 + ); } } else { window_error_open(STR_CANT_INCREASE_INTEREST_RATE, STR_NONE); @@ -645,9 +661,25 @@ static void window_editor_scenario_options_financial_mousedown(sint32 widgetInde case WIDX_INTEREST_RATE_DECREASE: if (gBankLoanInterestRate > 0) { if (gBankLoanInterestRate > 80) { - gBankLoanInterestRate = 80; + game_do_command( + 0, + GAME_COMMAND_FLAG_APPLY, + EDIT_SCENARIOOPTIONS_SETANNUALINTERESTRATE, + 80, + GAME_COMMAND_EDIT_SCENARIO_OPTIONS, + 0, + 0 + ); } else { - gBankLoanInterestRate--; + game_do_command( + 0, + GAME_COMMAND_FLAG_APPLY, + EDIT_SCENARIOOPTIONS_SETANNUALINTERESTRATE, + gBankLoanInterestRate - 1, + GAME_COMMAND_EDIT_SCENARIO_OPTIONS, + 0, + 0 + ); } } else { window_error_open(STR_CANT_REDUCE_INTEREST_RATE, STR_NONE);