1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-24 23:34:37 +01:00

#21193: Move gCash to GameState_t, refactor uses

This commit is contained in:
ζeh Matt
2024-01-20 15:46:35 +02:00
parent 2cb4eb950b
commit 3518a638bb
15 changed files with 175 additions and 153 deletions

View File

@@ -13,6 +13,7 @@
#include "../Date.h"
#include "../EditorObjectSelectionSession.h"
#include "../Game.h"
#include "../GameState.h"
#include "../OpenRCT2.h"
#include "../PlatformEnvironment.h"
#include "../ReplayManager.h"
@@ -78,6 +79,8 @@
# include "../drawing/TTF.h"
#endif
using namespace OpenRCT2;
using arguments_t = std::vector<std::string>;
using OpenRCT2::Date;
@@ -564,7 +567,7 @@ static int32_t ConsoleCommandGet(InteractiveConsole& console, const arguments_t&
}
else if (argv[0] == "money")
{
console.WriteFormatLine("money %d.%d0", gCash / 10, gCash % 10);
console.WriteFormatLine("money %d.%d0", GetGameState().Cash / 10, GetGameState().Cash % 10);
}
else if (argv[0] == "scenario_initial_cash")
{
@@ -767,7 +770,7 @@ static int32_t ConsoleCommandSet(InteractiveConsole& console, const arguments_t&
if (argv[0] == "money" && InvalidArguments(&invalidArgs, double_valid[0]))
{
money64 money = ToMoney64FromGBP(double_val[0]);
if (gCash != money)
if (GetGameState().Cash != money)
{
auto cheatSetAction = CheatSetAction(CheatType::SetMoney, money);
cheatSetAction.SetCallback([&console](const GameAction*, const GameActions::Result* res) {