Pass game state ref as parameter to game actions (#25065)

This commit is contained in:
Aaron van Geffen authored and GitHub committed 2025-09-08 16:21:29 +02:00
1 parent 3e10c20792
commit 4446ff9f6f
227 files changed
+927 -848

No files matched your search

+6 -5
View File
@@ -430,7 +430,7 @@ static void ShortcutLoadGame()
if (!(isInTrackDesignerOrManager()))
{
auto loadOrQuitAction = GameActions::LoadOrQuitAction(GameActions::LoadOrQuitModes::OpenSavePrompt);
GameActions::Execute(&loadOrQuitAction);
GameActions::Execute(&loadOrQuitAction, getGameState());
}
}
@@ -525,7 +525,7 @@ static void ShortcutToggleWallSlope()
auto modifyTile = GameActions::TileModifyAction(
windowTileInspectorTile.ToCoordsXY(), GameActions::TileModifyType::WallSetSlope, windowTileInspectorSelectedIndex,
newSlopeValue);
GameActions::Execute(&modifyTile);
GameActions::Execute(&modifyTile, getGameState());
}
static void ShortcutIncreaseElementHeight()
@@ -610,9 +610,10 @@ static void ShortcutDecreaseElementHeight()
static void ShortcutToggleClearanceChecks()
{
auto& gameState = getGameState();
auto cheatSetAction = GameActions::CheatSetAction(
CheatType::DisableClearanceChecks, getGameState().cheats.disableClearanceChecks ? 0 : 1);
GameActions::Execute(&cheatSetAction);
CheatType::DisableClearanceChecks, gameState.cheats.disableClearanceChecks ? 0 : 1);
GameActions::Execute(&cheatSetAction, gameState);
}
static void ShortcutToggleConsole()
@@ -784,7 +785,7 @@ void ShortcutManager::RegisterDefaultShortcuts()
if (gLegacyScene != LegacyScene::titleSequence && gLegacyScene != LegacyScene::scenarioEditor && gLegacyScene != LegacyScene::trackDesignsManager)
{
auto pauseToggleAction = GameActions::PauseToggleAction();
GameActions::Execute(&pauseToggleAction);
GameActions::Execute(&pauseToggleAction, getGameState());
}
});
RegisterShortcut(ShortcutId::kInterfaceDecreaseSpeed, STR_SHORTCUT_REDUCE_GAME_SPEED, "-", ShortcutReduceGameSpeed);
@@ -196,6 +196,7 @@ namespace OpenRCT2::Ui
bool ViewportInteractionLeftClick(const ScreenCoordsXY& screenCoords)
{
auto info = ViewportInteractionGetItemLeft(screenCoords);
auto& gameState = getGameState();
switch (info.interactionType)
{
@@ -224,7 +225,7 @@ namespace OpenRCT2::Ui
if (GameIsNotPaused())
{
auto balloonPress = GameActions::BalloonPressAction(entity->Id);
GameActions::Execute(&balloonPress);
GameActions::Execute(&balloonPress, gameState);
}
}
break;
@@ -627,7 +628,7 @@ namespace OpenRCT2::Ui
{ mapCoords.x, mapCoords.y, smallSceneryElement.GetBaseZ() }, smallSceneryElement.GetSceneryQuadrant(),
smallSceneryElement.GetEntryIndex());
GameActions::Execute(&removeSceneryAction);
GameActions::Execute(&removeSceneryAction, getGameState());
}
/**
@@ -651,7 +652,7 @@ namespace OpenRCT2::Ui
if (tileElement2->GetType() == TileElementType::Path && tileElement2->GetBaseZ() == z)
{
auto action = GameActions::FootpathRemoveAction({ mapCoords, z });
GameActions::Execute(&action);
GameActions::Execute(&action, getGameState());
break;
}
} while (!(tileElement2++)->IsLastForTile());
@@ -665,7 +666,7 @@ namespace OpenRCT2::Ui
{
auto footpathAdditionRemoveAction = GameActions::FootpathAdditionRemoveAction(
{ mapCoords.x, mapCoords.y, pathElement.GetBaseZ() });
GameActions::Execute(&footpathAdditionRemoveAction);
GameActions::Execute(&footpathAdditionRemoveAction, getGameState());
}
/**
@@ -686,7 +687,7 @@ namespace OpenRCT2::Ui
}
auto parkEntranceRemoveAction = GameActions::ParkEntranceRemoveAction(
{ mapCoords.x, mapCoords.y, entranceElement.GetBaseZ() });
GameActions::Execute(&parkEntranceRemoveAction);
GameActions::Execute(&parkEntranceRemoveAction, getGameState());
}
/**
@@ -704,7 +705,7 @@ namespace OpenRCT2::Ui
{
CoordsXYZD wallLocation = { mapCoords.x, mapCoords.y, wallElement.GetBaseZ(), wallElement.GetDirection() };
auto wallRemoveAction = GameActions::WallRemoveAction(wallLocation);
GameActions::Execute(&wallRemoveAction);
GameActions::Execute(&wallRemoveAction, getGameState());
}
}
@@ -726,7 +727,7 @@ namespace OpenRCT2::Ui
auto removeSceneryAction = GameActions::LargeSceneryRemoveAction(
{ mapCoords.x, mapCoords.y, largeSceneryElement.GetBaseZ(), largeSceneryElement.GetDirection() },
largeSceneryElement.GetSequenceIndex());
GameActions::Execute(&removeSceneryAction);
GameActions::Execute(&removeSceneryAction, getGameState());
}
}
+1 -1
View File
@@ -241,7 +241,7 @@ namespace OpenRCT2
RideConstructionStart(*ride);
});
GameActions::Execute(&gameAction);
GameActions::Execute(&gameAction, getGameState());
}
SpecialElementsDropdownState BuildSpecialElementsList(
+10 -5
View File
@@ -14,6 +14,7 @@
#include <openrct2-ui/interface/Widget.h>
#include <openrct2-ui/windows/Windows.h>
#include <openrct2/Game.h>
#include <openrct2/GameState.h>
#include <openrct2/SpriteIds.h>
#include <openrct2/actions/BannerRemoveAction.h>
#include <openrct2/actions/BannerSetNameAction.h>
@@ -191,6 +192,9 @@ namespace OpenRCT2::Ui::Windows
Close();
return;
}
auto& gameState = getGameState();
switch (widgetIndex)
{
case WIDX_CLOSE:
@@ -204,7 +208,7 @@ namespace OpenRCT2::Ui::Windows
auto bannerRemoveAction = GameActions::BannerRemoveAction(
{ banner->position.ToCoordsXY(), bannerElement->GetBaseZ(), bannerElement->GetPosition() });
GameActions::Execute(&bannerRemoveAction);
GameActions::Execute(&bannerRemoveAction, gameState);
break;
}
case WIDX_BANNER_TEXT:
@@ -216,7 +220,7 @@ namespace OpenRCT2::Ui::Windows
TextinputCancel();
auto bannerSetStyle = GameActions::BannerSetStyleAction(
GameActions::BannerSetStyleType::NoEntry, GetBannerIndex(), !banner->flags.has(BannerFlag::noEntry));
GameActions::Execute(&bannerSetStyle);
GameActions::Execute(&bannerSetStyle, gameState);
break;
}
}
@@ -224,6 +228,7 @@ namespace OpenRCT2::Ui::Windows
void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override
{
auto& gameState = getGameState();
switch (widgetIndex)
{
case WIDX_MAIN_COLOUR:
@@ -234,7 +239,7 @@ namespace OpenRCT2::Ui::Windows
auto bannerSetStyle = GameActions::BannerSetStyleAction(
GameActions::BannerSetStyleType::PrimaryColour, GetBannerIndex(),
ColourDropDownIndexToColour(dropdownIndex));
GameActions::Execute(&bannerSetStyle);
GameActions::Execute(&bannerSetStyle, gameState);
break;
}
case WIDX_TEXT_COLOUR_DROPDOWN_BUTTON:
@@ -243,7 +248,7 @@ namespace OpenRCT2::Ui::Windows
break;
auto bannerSetStyle = GameActions::BannerSetStyleAction(
GameActions::BannerSetStyleType::TextColour, GetBannerIndex(), dropdownIndex + 1);
GameActions::Execute(&bannerSetStyle);
GameActions::Execute(&bannerSetStyle, gameState);
break;
}
}
@@ -254,7 +259,7 @@ namespace OpenRCT2::Ui::Windows
if (widgetIndex == WIDX_BANNER_TEXT)
{
auto bannerSetNameAction = GameActions::BannerSetNameAction(GetBannerIndex(), std::string(text));
GameActions::Execute(&bannerSetNameAction);
GameActions::Execute(&bannerSetNameAction, getGameState());
}
}
+5 -4
View File
@@ -865,7 +865,8 @@ static StringId window_cheats_page_titles[] = {
void OnMouseDownDate(WidgetIndex widgetIndex)
{
auto* windowMgr = Ui::GetWindowManager();
auto* windowMgr = GetWindowManager();
auto& gameState = getGameState();
switch (widgetIndex)
{
@@ -911,14 +912,14 @@ static StringId window_cheats_page_titles[] = {
{
auto setDateAction = GameActions::ParkSetDateAction(
_yearSpinnerValue - 1, _monthSpinnerValue - 1, _daySpinnerValue - 1);
GameActions::Execute(&setDateAction);
GameActions::Execute(&setDateAction, gameState);
windowMgr->InvalidateByClass(WindowClass::BottomToolbar);
break;
}
case WIDX_DATE_RESET:
{
auto setDateAction = GameActions::ParkSetDateAction(0, 0, 0);
GameActions::Execute(&setDateAction);
GameActions::Execute(&setDateAction, gameState);
windowMgr->InvalidateByClass(WindowClass::BottomToolbar);
InvalidateWidget(WIDX_YEAR_BOX);
InvalidateWidget(WIDX_MONTH_BOX);
@@ -961,7 +962,7 @@ static StringId window_cheats_page_titles[] = {
{
auto cheatSetAction = GameActions::CheatSetAction(
CheatType::SetForcedParkRating, _parkRatingSpinnerValue);
GameActions::Execute(&cheatSetAction);
GameActions::Execute(&cheatSetAction, getGameState());
}
break;
case WIDX_DECREASE_PARK_RATING:
+3 -3
View File
@@ -289,7 +289,7 @@ namespace OpenRCT2::Ui::Windows
return;
auto action = GetClearAction();
auto result = GameActions::Query(&action);
auto result = GameActions::Query(&action, getGameState());
auto cost = (result.Error == GameActions::Status::Ok ? result.Cost : kMoney64Undefined);
if (_clearSceneryCost != cost)
{
@@ -317,7 +317,7 @@ namespace OpenRCT2::Ui::Windows
if (gMapSelectFlags & MAP_SELECT_FLAG_ENABLE)
{
auto action = GetClearAction();
GameActions::Execute(&action);
GameActions::Execute(&action, getGameState());
gCurrentToolId = Tool::bulldozer;
}
break;
@@ -334,7 +334,7 @@ namespace OpenRCT2::Ui::Windows
if (windowMgr->FindByClass(WindowClass::Error) == nullptr && (gMapSelectFlags & MAP_SELECT_FLAG_ENABLE))
{
auto action = GetClearAction();
GameActions::Execute(&action);
GameActions::Execute(&action, getGameState());
gCurrentToolId = Tool::bulldozer;
}
break;
@@ -63,7 +63,7 @@ namespace OpenRCT2::Ui::Windows
case WIDX_DEMOLISH:
{
auto gameAction = GameActions::RideDemolishAction(rideId, GameActions::RideModifyType::demolish);
GameActions::Execute(&gameAction);
GameActions::Execute(&gameAction, getGameState());
break;
}
case WIDX_CANCEL:
@@ -12,6 +12,7 @@
#include <openrct2-ui/interface/Widget.h>
#include <openrct2-ui/windows/Windows.h>
#include <openrct2/Context.h>
#include <openrct2/GameState.h>
#include <openrct2/Input.h>
#include <openrct2/SpriteIds.h>
#include <openrct2/actions/ParkEntrancePlaceAction.h>
@@ -200,7 +201,7 @@ namespace OpenRCT2::Ui::Windows
parkEntrancePosition, gFootpathSelectedId, _selectedEntranceType);
gameAction.SetFlags(GAME_COMMAND_FLAG_GHOST);
auto result = GameActions::Execute(&gameAction);
auto result = GameActions::Execute(&gameAction, getGameState());
if (result.Error == GameActions::Status::Ok)
{
gParkEntranceGhostPosition = parkEntrancePosition;
@@ -217,7 +218,7 @@ namespace OpenRCT2::Ui::Windows
{
auto gameAction = GameActions::ParkEntrancePlaceAction(
parkEntrancePosition, gFootpathSelectedId, _selectedEntranceType);
auto result = GameActions::Execute(&gameAction);
auto result = GameActions::Execute(&gameAction, getGameState());
if (result.Error == GameActions::Status::Ok)
{
Audio::Play3D(Audio::SoundId::PlaceItem, result.Position);
@@ -966,7 +966,7 @@ namespace OpenRCT2::Ui::Windows
auto scenarioSetSetting = GameActions::ScenarioSetSettingAction(
GameActions::ScenarioSetSetting::ParkRatingHigherDifficultyLevel,
gameState.park.flags & PARK_FLAGS_DIFFICULT_PARK_RATING ? 0 : 1);
GameActions::Execute(&scenarioSetSetting);
GameActions::Execute(&scenarioSetSetting, gameState);
Invalidate();
break;
}
@@ -1338,7 +1338,7 @@ namespace OpenRCT2::Ui::Windows
case WIDX_PARK_NAME:
{
auto action = GameActions::ParkSetNameAction(std::string(text));
GameActions::Execute(&action);
GameActions::Execute(&action, gameState);
if (scenarioOptions.name.empty())
{
@@ -1382,7 +1382,7 @@ namespace OpenRCT2::Ui::Windows
auto newMoneySetting = (gameState.park.flags & PARK_FLAGS_NO_MONEY) ? 0 : 1;
auto scenarioSetSetting = GameActions::ScenarioSetSettingAction(
GameActions::ScenarioSetSetting::NoMoney, newMoneySetting);
GameActions::Execute(&scenarioSetSetting);
GameActions::Execute(&scenarioSetSetting, gameState);
Invalidate();
break;
}
@@ -1391,7 +1391,7 @@ namespace OpenRCT2::Ui::Windows
auto scenarioSetSetting = GameActions::ScenarioSetSettingAction(
GameActions::ScenarioSetSetting::ForbidMarketingCampaigns,
gameState.park.flags & PARK_FLAGS_FORBID_MARKETING_CAMPAIGN ? 0 : 1);
GameActions::Execute(&scenarioSetSetting);
GameActions::Execute(&scenarioSetSetting, gameState);
Invalidate();
break;
}
@@ -1400,7 +1400,7 @@ namespace OpenRCT2::Ui::Windows
auto scenarioSetSetting = GameActions::ScenarioSetSettingAction(
GameActions::ScenarioSetSetting::UseRCT1Interest,
gameState.park.flags & PARK_FLAGS_RCT1_INTEREST ? 0 : 1);
GameActions::Execute(&scenarioSetSetting);
GameActions::Execute(&scenarioSetSetting, gameState);
Invalidate();
break;
}
@@ -1422,7 +1422,7 @@ namespace OpenRCT2::Ui::Windows
{
auto scenarioSetSetting = GameActions::ScenarioSetSettingAction(
GameActions::ScenarioSetSetting::InitialCash, gameState.scenarioOptions.initialCash + 500.00_GBP);
GameActions::Execute(&scenarioSetSetting);
GameActions::Execute(&scenarioSetSetting, gameState);
}
else
{
@@ -1435,7 +1435,7 @@ namespace OpenRCT2::Ui::Windows
{
auto scenarioSetSetting = GameActions::ScenarioSetSettingAction(
GameActions::ScenarioSetSetting::InitialCash, gameState.scenarioOptions.initialCash - 500.00_GBP);
GameActions::Execute(&scenarioSetSetting);
GameActions::Execute(&scenarioSetSetting, gameState);
}
else
{
@@ -1448,7 +1448,7 @@ namespace OpenRCT2::Ui::Windows
{
auto scenarioSetSetting = GameActions::ScenarioSetSettingAction(
GameActions::ScenarioSetSetting::InitialLoan, gameState.park.bankLoan + 1000.00_GBP);
GameActions::Execute(&scenarioSetSetting);
GameActions::Execute(&scenarioSetSetting, gameState);
}
else
{
@@ -1461,7 +1461,7 @@ namespace OpenRCT2::Ui::Windows
{
auto scenarioSetSetting = GameActions::ScenarioSetSettingAction(
GameActions::ScenarioSetSetting::InitialLoan, gameState.park.bankLoan - 1000.00_GBP);
GameActions::Execute(&scenarioSetSetting);
GameActions::Execute(&scenarioSetSetting, gameState);
}
else
{
@@ -1474,7 +1474,7 @@ namespace OpenRCT2::Ui::Windows
{
auto scenarioSetSetting = GameActions::ScenarioSetSettingAction(
GameActions::ScenarioSetSetting::MaximumLoanSize, gameState.park.maxBankLoan + 1000.00_GBP);
GameActions::Execute(&scenarioSetSetting);
GameActions::Execute(&scenarioSetSetting, gameState);
}
else
{
@@ -1487,7 +1487,7 @@ namespace OpenRCT2::Ui::Windows
{
auto scenarioSetSetting = GameActions::ScenarioSetSettingAction(
GameActions::ScenarioSetSetting::MaximumLoanSize, gameState.park.maxBankLoan - 1000.00_GBP);
GameActions::Execute(&scenarioSetSetting);
GameActions::Execute(&scenarioSetSetting, gameState);
}
else
{
@@ -1500,7 +1500,7 @@ namespace OpenRCT2::Ui::Windows
{
auto scenarioSetSetting = GameActions::ScenarioSetSettingAction(
GameActions::ScenarioSetSetting::AnnualInterestRate, gameState.park.bankLoanInterestRate + 1);
GameActions::Execute(&scenarioSetSetting);
GameActions::Execute(&scenarioSetSetting, gameState);
}
else
{
@@ -1514,7 +1514,7 @@ namespace OpenRCT2::Ui::Windows
auto interest = std::min<uint8_t>(kMaxBankLoanInterestRate, gameState.park.bankLoanInterestRate - 1);
auto scenarioSetSetting = GameActions::ScenarioSetSettingAction(
GameActions::ScenarioSetSetting::AnnualInterestRate, interest);
GameActions::Execute(&scenarioSetSetting);
GameActions::Execute(&scenarioSetSetting, gameState);
}
else
{
@@ -1527,7 +1527,7 @@ namespace OpenRCT2::Ui::Windows
{
auto scenarioSetSetting = GameActions::ScenarioSetSettingAction(
GameActions::ScenarioSetSetting::ParkChargeEntryFee, gameState.park.entranceFee + 1.00_GBP);
GameActions::Execute(&scenarioSetSetting);
GameActions::Execute(&scenarioSetSetting, gameState);
}
else
{
@@ -1540,7 +1540,7 @@ namespace OpenRCT2::Ui::Windows
{
auto scenarioSetSetting = GameActions::ScenarioSetSettingAction(
GameActions::ScenarioSetSetting::ParkChargeEntryFee, gameState.park.entranceFee - 1.00_GBP);
GameActions::Execute(&scenarioSetSetting);
GameActions::Execute(&scenarioSetSetting, gameState);
}
else
{
@@ -1592,7 +1592,7 @@ namespace OpenRCT2::Ui::Windows
{
auto scenarioSetSetting = GameActions::ScenarioSetSettingAction(
GameActions::ScenarioSetSetting::ParkChargeMethod, dropdownIndex);
GameActions::Execute(&scenarioSetSetting);
GameActions::Execute(&scenarioSetSetting, getGameState());
Invalidate();
break;
}
@@ -1785,7 +1785,7 @@ namespace OpenRCT2::Ui::Windows
{
auto scenarioSetSetting = GameActions::ScenarioSetSettingAction(
GameActions::ScenarioSetSetting::AverageCashPerGuest, scenarioOptions.guestInitialCash + 1.00_GBP);
GameActions::Execute(&scenarioSetSetting);
GameActions::Execute(&scenarioSetSetting, gameState);
}
else
{
@@ -1798,7 +1798,7 @@ namespace OpenRCT2::Ui::Windows
{
auto scenarioSetSetting = GameActions::ScenarioSetSettingAction(
GameActions::ScenarioSetSetting::AverageCashPerGuest, scenarioOptions.guestInitialCash - 1.00_GBP);
GameActions::Execute(&scenarioSetSetting);
GameActions::Execute(&scenarioSetSetting, gameState);
}
else
{
@@ -1811,7 +1811,7 @@ namespace OpenRCT2::Ui::Windows
{
auto scenarioSetSetting = GameActions::ScenarioSetSettingAction(
GameActions::ScenarioSetSetting::GuestInitialHappiness, scenarioOptions.guestInitialHappiness + 4);
GameActions::Execute(&scenarioSetSetting);
GameActions::Execute(&scenarioSetSetting, gameState);
}
else
{
@@ -1824,7 +1824,7 @@ namespace OpenRCT2::Ui::Windows
{
auto scenarioSetSetting = GameActions::ScenarioSetSettingAction(
GameActions::ScenarioSetSetting::GuestInitialHappiness, scenarioOptions.guestInitialHappiness - 4);
GameActions::Execute(&scenarioSetSetting);
GameActions::Execute(&scenarioSetSetting, gameState);
}
else
{
@@ -1837,7 +1837,7 @@ namespace OpenRCT2::Ui::Windows
{
auto scenarioSetSetting = GameActions::ScenarioSetSettingAction(
GameActions::ScenarioSetSetting::GuestInitialHunger, scenarioOptions.guestInitialHunger - 4);
GameActions::Execute(&scenarioSetSetting);
GameActions::Execute(&scenarioSetSetting, gameState);
}
else
{
@@ -1850,7 +1850,7 @@ namespace OpenRCT2::Ui::Windows
{
auto scenarioSetSetting = GameActions::ScenarioSetSettingAction(
GameActions::ScenarioSetSetting::GuestInitialHunger, scenarioOptions.guestInitialHunger + 4);
GameActions::Execute(&scenarioSetSetting);
GameActions::Execute(&scenarioSetSetting, gameState);
}
else
{
@@ -1863,7 +1863,7 @@ namespace OpenRCT2::Ui::Windows
{
auto scenarioSetSetting = GameActions::ScenarioSetSettingAction(
GameActions::ScenarioSetSetting::GuestInitialThirst, scenarioOptions.guestInitialThirst - 4);
GameActions::Execute(&scenarioSetSetting);
GameActions::Execute(&scenarioSetSetting, gameState);
}
else
{
@@ -1876,7 +1876,7 @@ namespace OpenRCT2::Ui::Windows
{
auto scenarioSetSetting = GameActions::ScenarioSetSettingAction(
GameActions::ScenarioSetSetting::GuestInitialThirst, scenarioOptions.guestInitialThirst + 4);
GameActions::Execute(&scenarioSetSetting);
GameActions::Execute(&scenarioSetSetting, gameState);
}
else
{
@@ -1917,7 +1917,7 @@ namespace OpenRCT2::Ui::Windows
auto scenarioSetSetting = GameActions::ScenarioSetSettingAction(
GameActions::ScenarioSetSetting::GuestGenerationHigherDifficultyLevel,
gameState.park.flags & PARK_FLAGS_DIFFICULT_GUEST_GENERATION ? 0 : 1);
GameActions::Execute(&scenarioSetSetting);
GameActions::Execute(&scenarioSetSetting, gameState);
Invalidate();
break;
}
@@ -1932,13 +1932,15 @@ namespace OpenRCT2::Ui::Windows
bool preferLess = dropdownIndex == 0 || dropdownIndex == 2;
bool preferMore = dropdownIndex == 0 || dropdownIndex == 3;
auto& gameState = getGameState();
auto scenarioSetLessSetting = GameActions::ScenarioSetSettingAction(
GameActions::ScenarioSetSetting::GuestsPreferLessIntenseRides, preferLess);
GameActions::Execute(&scenarioSetLessSetting);
GameActions::Execute(&scenarioSetLessSetting, gameState);
auto scenarioSetMoreSetting = GameActions::ScenarioSetSettingAction(
GameActions::ScenarioSetSetting::GuestsPreferMoreIntenseRides, preferMore);
GameActions::Execute(&scenarioSetMoreSetting);
GameActions::Execute(&scenarioSetMoreSetting, gameState);
}
void GuestsUpdate()
@@ -2044,7 +2046,7 @@ namespace OpenRCT2::Ui::Windows
auto scenarioSetSetting = GameActions::ScenarioSetSettingAction(
GameActions::ScenarioSetSetting::ForbidTreeRemoval,
gameState.park.flags & PARK_FLAGS_FORBID_TREE_REMOVAL ? 0 : 1);
GameActions::Execute(&scenarioSetSetting);
GameActions::Execute(&scenarioSetSetting, gameState);
Invalidate();
break;
}
@@ -2053,7 +2055,7 @@ namespace OpenRCT2::Ui::Windows
auto scenarioSetSetting = GameActions::ScenarioSetSettingAction(
GameActions::ScenarioSetSetting::ForbidLandscapeChanges,
gameState.park.flags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES ? 0 : 1);
GameActions::Execute(&scenarioSetSetting);
GameActions::Execute(&scenarioSetSetting, gameState);
Invalidate();
break;
}
@@ -2062,7 +2064,7 @@ namespace OpenRCT2::Ui::Windows
auto scenarioSetSetting = GameActions::ScenarioSetSettingAction(
GameActions::ScenarioSetSetting::ForbidHighConstruction,
gameState.park.flags & PARK_FLAGS_FORBID_HIGH_CONSTRUCTION ? 0 : 1);
GameActions::Execute(&scenarioSetSetting);
GameActions::Execute(&scenarioSetSetting, gameState);
Invalidate();
break;
}
@@ -2086,7 +2088,7 @@ namespace OpenRCT2::Ui::Windows
{
auto scenarioSetSetting = GameActions::ScenarioSetSettingAction(
GameActions::ScenarioSetSetting::CostToBuyLand, scenarioOptions.landPrice + 1.00_GBP);
GameActions::Execute(&scenarioSetSetting);
GameActions::Execute(&scenarioSetSetting, gameState);
}
else
{
@@ -2099,7 +2101,7 @@ namespace OpenRCT2::Ui::Windows
{
auto scenarioSetSetting = GameActions::ScenarioSetSettingAction(
GameActions::ScenarioSetSetting::CostToBuyLand, scenarioOptions.landPrice - 1.00_GBP);
GameActions::Execute(&scenarioSetSetting);
GameActions::Execute(&scenarioSetSetting, gameState);
}
else
{
@@ -2113,7 +2115,7 @@ namespace OpenRCT2::Ui::Windows
auto scenarioSetSetting = GameActions::ScenarioSetSettingAction(
GameActions::ScenarioSetSetting::CostToBuyConstructionRights,
scenarioOptions.constructionRightsPrice + 1.00_GBP);
GameActions::Execute(&scenarioSetSetting);
GameActions::Execute(&scenarioSetSetting, gameState);
}
else
{
@@ -2127,7 +2129,7 @@ namespace OpenRCT2::Ui::Windows
auto scenarioSetSetting = GameActions::ScenarioSetSettingAction(
GameActions::ScenarioSetSetting::CostToBuyConstructionRights,
scenarioOptions.constructionRightsPrice - 1.00_GBP);
GameActions::Execute(&scenarioSetSetting);
GameActions::Execute(&scenarioSetSetting, gameState);
}
else
{
+2 -2
View File
@@ -548,7 +548,7 @@ namespace OpenRCT2::Ui::Windows
newLoan = std::min(gameState.park.maxBankLoan, newLoan);
}
auto gameAction = GameActions::ParkSetLoanAction(newLoan);
GameActions::Execute(&gameAction);
GameActions::Execute(&gameAction, gameState);
break;
}
case WIDX_LOAN_DECREASE:
@@ -564,7 +564,7 @@ namespace OpenRCT2::Ui::Windows
newLoan = std::max(static_cast<money64>(0LL), newLoan);
}
auto gameAction = GameActions::ParkSetLoanAction(newLoan);
GameActions::Execute(&gameAction);
GameActions::Execute(&gameAction, gameState);
}
break;
}
+8 -8
View File
@@ -1158,7 +1158,7 @@ namespace OpenRCT2::Ui::Windows
_footpathErrorOccured = true;
}
});
GameActions::Execute(&footpathPlaceAction);
GameActions::Execute(&footpathPlaceAction, getGameState());
}
/**
@@ -1278,7 +1278,7 @@ namespace OpenRCT2::Ui::Windows
}
self->WindowFootpathSetEnabledAndPressedWidgets();
});
GameActions::Execute(&footpathPlaceAction);
GameActions::Execute(&footpathPlaceAction, getGameState());
}
/**
@@ -1319,7 +1319,7 @@ namespace OpenRCT2::Ui::Windows
gFootpathConstructFromPosition.z = tileElement->GetBaseZ();
auto action = GameActions::FootpathRemoveAction(gFootpathConstructFromPosition);
GameActions::Execute(&action);
GameActions::Execute(&action, getGameState());
// Move selection
edge = DirectionReverse(edge);
@@ -1750,15 +1750,15 @@ namespace OpenRCT2::Ui::Windows
ObjectEntryIndex type, ObjectEntryIndex railingsType, const CoordsXYZ& footpathLoc, int32_t slope,
PathConstructFlags constructFlags)
{
money64 cost;
FootpathRemoveProvisional();
auto footpathPlaceAction = GameActions::FootpathPlaceAction(
footpathLoc, slope, type, railingsType, kInvalidDirection, constructFlags);
footpathPlaceAction.SetFlags(GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED);
auto res = GameActions::Execute(&footpathPlaceAction);
cost = res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined;
auto res = GameActions::Execute(&footpathPlaceAction, getGameState());
money64 cost = res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined;
if (res.Error == GameActions::Status::Ok)
{
_provisionalFootpath.surfaceIndex = type;
@@ -1814,7 +1814,7 @@ namespace OpenRCT2::Ui::Windows
auto action = GameActions::FootpathRemoveAction(_provisionalFootpath.position);
action.SetFlags(GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_NO_SPEND | GAME_COMMAND_FLAG_GHOST);
GameActions::Execute(&action);
GameActions::Execute(&action, getGameState());
}
}
+6 -5
View File
@@ -641,6 +641,7 @@ namespace OpenRCT2::Ui::Windows
return;
}
auto& gameState = getGameState();
switch (widgetIndex)
{
case WIDX_PICKUP:
@@ -666,7 +667,7 @@ namespace OpenRCT2::Ui::Windows
ToolSet(*wind, WC_PEEP__WIDX_PICKUP, Tool::picker);
}
});
GameActions::Execute(&pickupAction);
GameActions::Execute(&pickupAction, gameState);
}
break;
case WIDX_RENAME:
@@ -681,7 +682,7 @@ namespace OpenRCT2::Ui::Windows
uint32_t guestFlags = peep->PeepFlags ^ PEEP_FLAGS_TRACKING;
auto guestSetFlagsAction = GameActions::GuestSetFlagsAction(EntityId::FromUnderlying(number), guestFlags);
GameActions::Execute(&guestSetFlagsAction);
GameActions::Execute(&guestSetFlagsAction, gameState);
}
break;
}
@@ -965,7 +966,7 @@ namespace OpenRCT2::Ui::Windows
return;
std::string sText(text);
auto gameAction = GameActions::GuestSetNameAction(EntityId::FromUnderlying(number), sText);
GameActions::Execute(&gameAction);
GameActions::Execute(&gameAction, getGameState());
}
void OnToolUpdateOverview(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords)
@@ -1031,7 +1032,7 @@ namespace OpenRCT2::Ui::Windows
ToolCancel();
gPickupPeepImage = ImageId();
});
GameActions::Execute(&pickupAction);
GameActions::Execute(&pickupAction, getGameState());
}
void OnToolAbortOverview(WidgetIndex widgetIndex)
@@ -1043,7 +1044,7 @@ namespace OpenRCT2::Ui::Windows
EntityId::FromUnderlying(number),
{ _pickedPeepX, 0, 0 },
Network::GetCurrentPlayerId() };
GameActions::Execute(&pickupAction);
GameActions::Execute(&pickupAction, getGameState());
}
#pragma endregion
+14 -10
View File
@@ -338,22 +338,24 @@ namespace OpenRCT2::Ui::Windows
centreX += 16;
centreY += 16;
auto& gameState = getGameState();
if (_landToolMountainMode)
{
auto landSmoothAction = GameActions::LandSmoothAction(
{ centreX, centreY },
{ gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y },
gMapSelectType, false);
auto res = (flag & GAME_COMMAND_FLAG_APPLY) ? GameActions::Execute(&landSmoothAction)
: GameActions::Query(&landSmoothAction);
auto res = (flag & GAME_COMMAND_FLAG_APPLY) ? GameActions::Execute(&landSmoothAction, gameState)
: GameActions::Query(&landSmoothAction, gameState);
return res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined;
}
auto landRaiseAction = GameActions::LandRaiseAction(
{ centreX, centreY },
{ gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }, gMapSelectType);
auto res = (flag & GAME_COMMAND_FLAG_APPLY) ? GameActions::Execute(&landRaiseAction)
: GameActions::Query(&landRaiseAction);
auto res = (flag & GAME_COMMAND_FLAG_APPLY) ? GameActions::Execute(&landRaiseAction, gameState)
: GameActions::Query(&landRaiseAction, gameState);
return res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined;
}
@@ -369,22 +371,24 @@ namespace OpenRCT2::Ui::Windows
centreX += 16;
centreY += 16;
auto& gameState = getGameState();
if (_landToolMountainMode)
{
auto landSmoothAction = GameActions::LandSmoothAction(
{ centreX, centreY },
{ gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y },
gMapSelectType, true);
auto res = (flag & GAME_COMMAND_FLAG_APPLY) ? GameActions::Execute(&landSmoothAction)
: GameActions::Query(&landSmoothAction);
auto res = (flag & GAME_COMMAND_FLAG_APPLY) ? GameActions::Execute(&landSmoothAction, gameState)
: GameActions::Query(&landSmoothAction, gameState);
return res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined;
}
auto landLowerAction = GameActions::LandLowerAction(
{ centreX, centreY },
{ gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }, gMapSelectType);
auto res = (flag & GAME_COMMAND_FLAG_APPLY) ? GameActions::Execute(&landLowerAction)
: GameActions::Query(&landLowerAction);
auto res = (flag & GAME_COMMAND_FLAG_APPLY) ? GameActions::Execute(&landLowerAction, gameState)
: GameActions::Query(&landLowerAction, gameState);
return res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined;
}
@@ -526,7 +530,7 @@ namespace OpenRCT2::Ui::Windows
{ gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y },
gLandToolTerrainSurface, gLandToolTerrainEdge);
GameActions::Execute(&surfaceSetStyleAction);
GameActions::Execute(&surfaceSetStyleAction, getGameState());
gCurrentToolId = Tool::upDownArrow;
}
@@ -553,7 +557,7 @@ namespace OpenRCT2::Ui::Windows
{ gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y },
gLandToolTerrainSurface, gLandToolTerrainEdge);
GameActions::Execute(&surfaceSetStyleAction);
GameActions::Execute(&surfaceSetStyleAction, getGameState());
// The tool is set to 12 here instead of 3 so that the dragging cursor is not the elevation change
// cursor
+6 -4
View File
@@ -533,16 +533,17 @@ namespace OpenRCT2::Ui::Windows
if (!state_changed)
return;
auto& gameState = getGameState();
if (IsOwnershipMode())
{
auto landSetRightsAction = GetLandSetAction();
auto res = GameActions::Query(&landSetRightsAction);
auto res = GameActions::Query(&landSetRightsAction, gameState);
_landRightsCost = res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined;
}
else
{
auto landBuyRightsAction = GetLandBuyAction();
auto res = GameActions::Query(&landBuyRightsAction);
auto res = GameActions::Query(&landBuyRightsAction, gameState);
_landRightsCost = res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined;
}
}
@@ -561,15 +562,16 @@ namespace OpenRCT2::Ui::Windows
if (screenCoords.x == kLocationNull)
return;
auto& gameState = getGameState();
if (IsOwnershipMode())
{
auto landSetRightsAction = GetLandSetAction();
GameActions::Execute(&landSetRightsAction);
GameActions::Execute(&landSetRightsAction, gameState);
}
else
{
auto landBuyRightsAction = GetLandBuyAction();
GameActions::Execute(&landBuyRightsAction);
GameActions::Execute(&landBuyRightsAction, gameState);
}
}
+4 -4
View File
@@ -484,7 +484,7 @@ namespace OpenRCT2::Ui::Windows
int32_t mapZ = tileElement->GetBaseZ();
auto gameAction = GameActions::PeepSpawnPlaceAction({ mapCoords, mapZ, static_cast<Direction>(direction) });
auto result = GameActions::Execute(&gameAction);
auto result = GameActions::Execute(&gameAction, getGameState());
if (result.Error == GameActions::Status::Ok)
{
Audio::Play3D(Audio::SoundId::PlaceItem, result.Position);
@@ -518,7 +518,7 @@ namespace OpenRCT2::Ui::Windows
newMapSize.x = size;
auto mapChangeSizeAction = GameActions::MapChangeSizeAction(newMapSize);
GameActions::Execute(&mapChangeSizeAction);
GameActions::Execute(&mapChangeSizeAction, getGameState());
Invalidate();
}
break;
@@ -766,7 +766,7 @@ namespace OpenRCT2::Ui::Windows
newMapSize.x++;
auto increaseMapSizeAction = GameActions::MapChangeSizeAction(newMapSize);
GameActions::Execute(&increaseMapSizeAction);
GameActions::Execute(&increaseMapSizeAction, getGameState());
}
void DecreaseMapSize()
@@ -778,7 +778,7 @@ namespace OpenRCT2::Ui::Windows
newMapSize.x--;
auto decreaseMapSizeAction = GameActions::MapChangeSizeAction(newMapSize);
GameActions::Execute(&decreaseMapSizeAction);
GameActions::Execute(&decreaseMapSizeAction, getGameState());
}
void SetMapPixels()
+4 -3
View File
@@ -14,6 +14,7 @@
#include <openrct2-ui/windows/Windows.h>
#include <openrct2/Context.h>
#include <openrct2/Game.h>
#include <openrct2/GameState.h>
#include <openrct2/Input.h>
#include <openrct2/SpriteIds.h>
#include <openrct2/actions/MazeSetTrackAction.h>
@@ -134,7 +135,7 @@ namespace OpenRCT2::Ui::Windows
{
auto gameAction = GameActions::RideDemolishAction(currentRide->id, GameActions::RideModifyType::demolish);
gameAction.SetFlags(GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED);
GameActions::Execute(&gameAction);
GameActions::Execute(&gameAction, getGameState());
}
else
{
@@ -393,7 +394,7 @@ namespace OpenRCT2::Ui::Windows
WindowMazeConstructionUpdatePressedWidgets();
}
});
auto res = GameActions::Execute(&rideEntranceExitPlaceAction);
auto res = GameActions::Execute(&rideEntranceExitPlaceAction, getGameState());
}
void WindowMazeConstructionConstruct(int32_t direction)
@@ -426,7 +427,7 @@ namespace OpenRCT2::Ui::Windows
const auto loc = CoordsXYZD{ x, y, z, static_cast<uint8_t>(direction) };
auto action = GameActions::MazeSetTrackAction(loc, false, _currentRideIndex, mode);
action.SetFlags(actionFlags);
const auto res = GameActions::Execute(&action);
const auto res = GameActions::Execute(&action, getGameState());
if (res.Error != GameActions::Status::Ok)
{
return;
+8 -5
View File
@@ -12,6 +12,7 @@
#include <openrct2-ui/interface/Widget.h>
#include <openrct2-ui/windows/Windows.h>
#include <openrct2/Game.h>
#include <openrct2/GameState.h>
#include <openrct2/SpriteIds.h>
#include <openrct2/actions/NetworkModifyGroupAction.h>
#include <openrct2/config/Config.h>
@@ -242,6 +243,8 @@ namespace OpenRCT2::Ui::Windows
}
break;
}
auto& gameState = getGameState();
switch (page)
{
case WINDOW_MULTIPLAYER_PAGE_GROUPS:
@@ -251,14 +254,14 @@ namespace OpenRCT2::Ui::Windows
case WIDX_ADD_GROUP:
{
auto networkModifyGroup = GameActions::NetworkModifyGroupAction(GameActions::ModifyGroupType::AddGroup);
GameActions::Execute(&networkModifyGroup);
GameActions::Execute(&networkModifyGroup, gameState);
break;
}
case WIDX_REMOVE_GROUP:
{
auto networkModifyGroup = GameActions::NetworkModifyGroupAction(
GameActions::ModifyGroupType::RemoveGroup, _selectedGroup);
GameActions::Execute(&networkModifyGroup);
GameActions::Execute(&networkModifyGroup, gameState);
break;
}
case WIDX_RENAME_GROUP:
@@ -483,7 +486,7 @@ namespace OpenRCT2::Ui::Windows
{
auto networkModifyGroup = GameActions::NetworkModifyGroupAction(
GameActions::ModifyGroupType::SetDefault, Network::GetGroupID(selectedIndex));
GameActions::Execute(&networkModifyGroup);
GameActions::Execute(&networkModifyGroup, getGameState());
break;
}
case WIDX_SELECTED_GROUP_DROPDOWN:
@@ -512,7 +515,7 @@ namespace OpenRCT2::Ui::Windows
auto networkModifyGroup = GameActions::NetworkModifyGroupAction(
GameActions::ModifyGroupType::SetName, _selectedGroup, std::string(text));
GameActions::Execute(&networkModifyGroup);
GameActions::Execute(&networkModifyGroup, getGameState());
break;
}
}
@@ -638,7 +641,7 @@ namespace OpenRCT2::Ui::Windows
auto networkModifyGroup = GameActions::NetworkModifyGroupAction(
GameActions::ModifyGroupType::SetPermissions, _selectedGroup, "", index,
GameActions::PermissionState::Toggle);
GameActions::Execute(&networkModifyGroup);
GameActions::Execute(&networkModifyGroup, getGameState());
break;
}
}
+2 -1
View File
@@ -12,6 +12,7 @@
#include <openrct2-ui/interface/Widget.h>
#include <openrct2-ui/windows/Windows.h>
#include <openrct2/Game.h>
#include <openrct2/GameState.h>
#include <openrct2/actions/ParkMarketingAction.h>
#include <openrct2/core/BitSet.hpp>
#include <openrct2/core/String.hpp>
@@ -272,7 +273,7 @@ namespace OpenRCT2::Ui::Windows
windowMgr->CloseByClass(WindowClass::NewCampaign);
}
});
GameActions::Execute(&gameAction);
GameActions::Execute(&gameAction, getGameState());
break;
}
}
+2 -1
View File
@@ -19,6 +19,7 @@
#include <openrct2-ui/interface/Widget.h>
#include <openrct2-ui/windows/Windows.h>
#include <openrct2/Diagnostic.h>
#include <openrct2/GameState.h>
#include <openrct2/PlatformEnvironment.h>
#include <openrct2/SpriteIds.h>
#include <openrct2/actions/ScenarioSetSettingAction.h>
@@ -1887,7 +1888,7 @@ namespace OpenRCT2::Ui::Windows
{
auto setAllowEarlyCompletionAction = GameActions::ScenarioSetSettingAction(
GameActions::ScenarioSetSetting::AllowEarlyCompletion, Config::Get().general.AllowEarlyCompletion);
GameActions::Execute(&setAllowEarlyCompletionAction);
GameActions::Execute(&setAllowEarlyCompletionAction, getGameState());
}
Config::Save();
Invalidate();
+5 -5
View File
@@ -492,7 +492,7 @@ namespace OpenRCT2::Ui::Windows
if (widgetIndex == WIDX_RENAME && !text.empty())
{
auto action = GameActions::ParkSetNameAction(std::string(text));
GameActions::Execute(&action);
GameActions::Execute(&action, getGameState());
}
}
@@ -810,21 +810,21 @@ namespace OpenRCT2::Ui::Windows
void OnMouseDownPrice(WidgetIndex widgetIndex)
{
const auto& gameState = getGameState();
auto& gameState = getGameState();
switch (widgetIndex)
{
case WIDX_INCREASE_PRICE:
{
const auto newFee = std::min(kMaxEntranceFee, gameState.park.entranceFee + 1.00_GBP);
auto gameAction = GameActions::ParkSetEntranceFeeAction(newFee);
GameActions::Execute(&gameAction);
GameActions::Execute(&gameAction, gameState);
break;
}
case WIDX_DECREASE_PRICE:
{
const auto newFee = std::max(0.00_GBP, gameState.park.entranceFee - 1.00_GBP);
auto gameAction = GameActions::ParkSetEntranceFeeAction(newFee);
GameActions::Execute(&gameAction);
GameActions::Execute(&gameAction, gameState);
break;
}
case WIDX_PRICE:
@@ -1039,7 +1039,7 @@ namespace OpenRCT2::Ui::Windows
money = std::clamp(money, 0.00_GBP, kMaxEntranceFee);
auto gameAction = GameActions::ParkSetEntranceFeeAction(money);
GameActions::Execute(&gameAction);
GameActions::Execute(&gameAction, getGameState());
}
}
+1 -1
View File
@@ -223,7 +223,7 @@ namespace OpenRCT2::Ui::Windows
{
MapRange range(gMapSelectPositionA, gMapSelectPositionB);
auto staffSetPatrolAreaAction = GameActions::StaffSetPatrolAreaAction(_staffId, range, _mode);
GameActions::Execute(&staffSetPatrolAreaAction);
GameActions::Execute(&staffSetPatrolAreaAction, getGameState());
}
}
+3 -2
View File
@@ -12,6 +12,7 @@
#include <openrct2-ui/interface/Dropdown.h>
#include <openrct2-ui/interface/Widget.h>
#include <openrct2-ui/windows/Windows.h>
#include <openrct2/GameState.h>
#include <openrct2/Input.h>
#include <openrct2/SpriteIds.h>
#include <openrct2/actions/PlayerKickAction.h>
@@ -509,7 +510,7 @@ namespace OpenRCT2::Ui::Windows
case WIDX_KICK:
{
auto kickPlayerAction = GameActions::PlayerKickAction(number);
GameActions::Execute(&kickPlayerAction);
GameActions::Execute(&kickPlayerAction, getGameState());
}
break;
}
@@ -538,7 +539,7 @@ namespace OpenRCT2::Ui::Windows
windowMgr->InvalidateByNumber(windowHandle.first, windowHandle.second);
}
});
GameActions::Execute(&playerSetGroupAction);
GameActions::Execute(&playerSetGroupAction, getGameState());
}
void ShowGroupDropdownOverview(Widget* widget)
@@ -62,7 +62,7 @@ namespace OpenRCT2::Ui::Windows
case WIDX_REFURBISH:
{
auto gameAction = GameActions::RideDemolishAction(rideId, GameActions::RideModifyType::renew);
GameActions::Execute(&gameAction);
GameActions::Execute(&gameAction, getGameState());
break;
}
case WIDX_CANCEL:
+2 -2
View File
@@ -507,7 +507,7 @@ namespace OpenRCT2::Ui::Windows
activeResearchTypes ^= 1uLL << (widgetIndex - (WIDX_TRANSPORT_RIDES + widgetOffset));
auto gameAction = GameActions::ParkSetResearchFundingAction(
activeResearchTypes, gameState.researchFundingLevel);
GameActions::Execute(&gameAction);
GameActions::Execute(&gameAction, getGameState());
break;
}
}
@@ -522,7 +522,7 @@ namespace OpenRCT2::Ui::Windows
return;
auto gameAction = GameActions::ParkSetResearchFundingAction(gameState.researchPriorities, selectedIndex);
GameActions::Execute(&gameAction);
GameActions::Execute(&gameAction, getGameState());
}
void WindowResearchFundingPrepareDraw(WindowBase* w, WidgetIndex baseWidgetIndex)
+26 -23
View File
@@ -1673,7 +1673,7 @@ namespace OpenRCT2::Ui::Windows
break;
}
auto gameAction = GameActions::RideSetStatusAction(ride->id, status);
GameActions::Execute(&gameAction);
GameActions::Execute(&gameAction, getGameState());
}
break;
}
@@ -2167,6 +2167,7 @@ namespace OpenRCT2::Ui::Windows
void MainOnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex)
{
auto& gameState = getGameState();
switch (widgetIndex)
{
case WIDX_VIEW_DROPDOWN:
@@ -2207,7 +2208,7 @@ namespace OpenRCT2::Ui::Windows
status = static_cast<RideStatus>(gDropdown.items[dropdownIndex].value);
}
auto gameAction = GameActions::RideSetStatusAction(ride->id, status);
GameActions::Execute(&gameAction);
GameActions::Execute(&gameAction, gameState);
}
break;
}
@@ -2228,7 +2229,7 @@ namespace OpenRCT2::Ui::Windows
_currentTrackAlternative.clearAll();
RideConstructionSetDefaultNextPiece();
});
GameActions::Execute(&rideSetSetting);
GameActions::Execute(&rideSetSetting, gameState);
}
}
break;
@@ -2291,7 +2292,7 @@ namespace OpenRCT2::Ui::Windows
{
auto strText = std::string(text);
auto gameAction = GameActions::RideSetNameAction(ride->id, strText);
GameActions::Execute(&gameAction);
GameActions::Execute(&gameAction, getGameState());
}
}
@@ -4181,7 +4182,7 @@ namespace OpenRCT2::Ui::Windows
auto gameAction = GameActions::RideSetColourSchemeAction(
CoordsXYZD{ info.Loc, z, static_cast<Direction>(direction) }, info.Element->AsTrack()->GetTrackType(),
newColourScheme);
GameActions::Execute(&gameAction);
GameActions::Execute(&gameAction, getGameState());
}
void ColourClose()
@@ -4192,6 +4193,7 @@ namespace OpenRCT2::Ui::Windows
void ColourOnMouseUp(WidgetIndex widgetIndex)
{
auto& gameState = getGameState();
switch (widgetIndex)
{
case WIDX_CLOSE:
@@ -4220,7 +4222,7 @@ namespace OpenRCT2::Ui::Windows
const bool currentlyEnabled = ride->hasLifecycleFlag(RIDE_LIFECYCLE_RANDOM_SHOP_COLOURS);
auto rideSetAppearanceAction = GameActions::RideSetAppearanceAction(
rideId, GameActions::RideSetAppearanceType::SellingItemColourIsRandom, currentlyEnabled ? 0 : 1, 0);
GameActions::Execute(&rideSetAppearanceAction);
GameActions::Execute(&rideSetAppearanceAction, gameState);
}
break;
}
@@ -4262,7 +4264,7 @@ namespace OpenRCT2::Ui::Windows
colour_t colour = UtilRand() % kColourNumNormal;
auto vehicleSetBodyColourAction = GameActions::RideSetAppearanceAction(
rideId, GameActions::RideSetAppearanceType::VehicleColourBody, colour, i);
GameActions::Execute(&vehicleSetBodyColourAction);
GameActions::Execute(&vehicleSetBodyColourAction, gameState);
}
if (allowChangingTrimColour)
@@ -4270,7 +4272,7 @@ namespace OpenRCT2::Ui::Windows
colour_t colour = UtilRand() % kColourNumNormal;
auto vehicleSetTrimColourAction = GameActions::RideSetAppearanceAction(
rideId, GameActions::RideSetAppearanceType::VehicleColourTrim, colour, i);
GameActions::Execute(&vehicleSetTrimColourAction);
GameActions::Execute(&vehicleSetTrimColourAction, gameState);
}
if (allowChangingTertiaryColour)
@@ -4278,7 +4280,7 @@ namespace OpenRCT2::Ui::Windows
colour_t colour = UtilRand() % kColourNumNormal;
auto vehicleSetTertiaryColourAction = GameActions::RideSetAppearanceAction(
rideId, GameActions::RideSetAppearanceType::VehicleColourTertiary, colour, i);
GameActions::Execute(&vehicleSetTertiaryColourAction);
GameActions::Execute(&vehicleSetTertiaryColourAction, gameState);
}
}
break;
@@ -4438,6 +4440,7 @@ namespace OpenRCT2::Ui::Windows
if (dropdownIndex == -1)
return;
auto& gameState = getGameState();
switch (widgetIndex)
{
case WIDX_TRACK_COLOUR_SCHEME_DROPDOWN:
@@ -4449,7 +4452,7 @@ namespace OpenRCT2::Ui::Windows
auto rideSetAppearanceAction = GameActions::RideSetAppearanceAction(
rideId, GameActions::RideSetAppearanceType::TrackColourMain, ColourDropDownIndexToColour(dropdownIndex),
_rideColour);
GameActions::Execute(&rideSetAppearanceAction);
GameActions::Execute(&rideSetAppearanceAction, gameState);
}
break;
case WIDX_TRACK_ADDITIONAL_COLOUR:
@@ -4457,7 +4460,7 @@ namespace OpenRCT2::Ui::Windows
auto rideSetAppearanceAction = GameActions::RideSetAppearanceAction(
rideId, GameActions::RideSetAppearanceType::TrackColourAdditional,
ColourDropDownIndexToColour(dropdownIndex), _rideColour);
GameActions::Execute(&rideSetAppearanceAction);
GameActions::Execute(&rideSetAppearanceAction, gameState);
}
break;
case WIDX_TRACK_SUPPORT_COLOUR:
@@ -4465,14 +4468,14 @@ namespace OpenRCT2::Ui::Windows
auto rideSetAppearanceAction = GameActions::RideSetAppearanceAction(
rideId, GameActions::RideSetAppearanceType::TrackColourSupports,
ColourDropDownIndexToColour(dropdownIndex), _rideColour);
GameActions::Execute(&rideSetAppearanceAction);
GameActions::Execute(&rideSetAppearanceAction, gameState);
}
break;
case WIDX_MAZE_STYLE_DROPDOWN:
{
auto rideSetAppearanceAction = GameActions::RideSetAppearanceAction(
rideId, GameActions::RideSetAppearanceType::MazeStyle, dropdownIndex, _rideColour);
GameActions::Execute(&rideSetAppearanceAction);
GameActions::Execute(&rideSetAppearanceAction, gameState);
}
break;
case WIDX_ENTRANCE_STYLE_DROPDOWN:
@@ -4490,7 +4493,7 @@ namespace OpenRCT2::Ui::Windows
return;
getGameState().lastEntranceStyle = objIndex;
});
GameActions::Execute(&rideSetAppearanceAction);
GameActions::Execute(&rideSetAppearanceAction, gameState);
break;
}
case WIDX_VEHICLE_COLOUR_SCHEME_DROPDOWN:
@@ -4504,7 +4507,7 @@ namespace OpenRCT2::Ui::Windows
ResetVehicleIndex();
}
});
GameActions::Execute(&rideSetAppearanceAction);
GameActions::Execute(&rideSetAppearanceAction, gameState);
break;
}
case WIDX_VEHICLE_COLOUR_INDEX_DROPDOWN:
@@ -4516,7 +4519,7 @@ namespace OpenRCT2::Ui::Windows
auto rideSetAppearanceAction = GameActions::RideSetAppearanceAction(
rideId, GameActions::RideSetAppearanceType::VehicleColourBody,
ColourDropDownIndexToColour(dropdownIndex), _vehicleIndex);
GameActions::Execute(&rideSetAppearanceAction);
GameActions::Execute(&rideSetAppearanceAction, gameState);
}
break;
case WIDX_VEHICLE_TRIM_COLOUR:
@@ -4524,7 +4527,7 @@ namespace OpenRCT2::Ui::Windows
auto rideSetAppearanceAction = GameActions::RideSetAppearanceAction(
rideId, GameActions::RideSetAppearanceType::VehicleColourTrim,
ColourDropDownIndexToColour(dropdownIndex), _vehicleIndex);
GameActions::Execute(&rideSetAppearanceAction);
GameActions::Execute(&rideSetAppearanceAction, gameState);
}
break;
case WIDX_VEHICLE_TERTIARY_COLOUR:
@@ -4532,7 +4535,7 @@ namespace OpenRCT2::Ui::Windows
auto rideSetAppearanceAction = GameActions::RideSetAppearanceAction(
rideId, GameActions::RideSetAppearanceType::VehicleColourTertiary,
ColourDropDownIndexToColour(dropdownIndex), _vehicleIndex);
GameActions::Execute(&rideSetAppearanceAction);
GameActions::Execute(&rideSetAppearanceAction, gameState);
}
break;
}
@@ -6241,7 +6244,7 @@ namespace OpenRCT2::Ui::Windows
}
auto parkSetParameter = GameActions::ParkSetParameterAction(GameActions::ParkParameter::SamePriceInPark, newFlags);
GameActions::Execute(&parkSetParameter);
GameActions::Execute(&parkSetParameter, getGameState());
}
void IncomeTogglePrimaryPrice()
@@ -6274,7 +6277,7 @@ namespace OpenRCT2::Ui::Windows
UpdateSamePriceThroughoutFlags(shopItem);
auto rideSetPriceAction = GameActions::RideSetPriceAction(rideId, ride->price[0], true);
GameActions::Execute(&rideSetPriceAction);
GameActions::Execute(&rideSetPriceAction, getGameState());
}
void IncomeToggleSecondaryPrice()
@@ -6294,13 +6297,13 @@ namespace OpenRCT2::Ui::Windows
UpdateSamePriceThroughoutFlags(shop_item);
auto rideSetPriceAction = GameActions::RideSetPriceAction(rideId, ride->price[1], false);
GameActions::Execute(&rideSetPriceAction);
GameActions::Execute(&rideSetPriceAction, getGameState());
}
void IncomeSetPrimaryPrice(money64 price)
{
auto rideSetPriceAction = GameActions::RideSetPriceAction(rideId, price, true);
GameActions::Execute(&rideSetPriceAction);
GameActions::Execute(&rideSetPriceAction, getGameState());
}
void IncomeIncreasePrimaryPrice()
@@ -6347,7 +6350,7 @@ namespace OpenRCT2::Ui::Windows
void IncomeSetSecondaryPrice(money64 price)
{
auto rideSetPriceAction = GameActions::RideSetPriceAction(rideId, price, false);
GameActions::Execute(&rideSetPriceAction);
GameActions::Execute(&rideSetPriceAction, getGameState());
}
bool IncomeCanModifyPrimaryPrice()
+17 -14
View File
@@ -306,6 +306,8 @@ namespace OpenRCT2::Ui::Windows
return;
}
auto& gameState = getGameState();
if (RideTryGetOriginElement(*currentRide, nullptr))
{
// Auto open shops if required.
@@ -317,7 +319,7 @@ namespace OpenRCT2::Ui::Windows
{
_autoOpeningShop = true;
auto gameAction = GameActions::RideSetStatusAction(currentRide->id, RideStatus::open);
GameActions::Execute(&gameAction);
GameActions::Execute(&gameAction, gameState);
_autoOpeningShop = false;
}
}
@@ -331,7 +333,7 @@ namespace OpenRCT2::Ui::Windows
{
auto gameAction = GameActions::RideDemolishAction(currentRide->id, GameActions::RideModifyType::demolish);
gameAction.SetFlags(GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED);
GameActions::Execute(&gameAction);
GameActions::Execute(&gameAction, gameState);
}
}
@@ -1104,7 +1106,7 @@ namespace OpenRCT2::Ui::Windows
auto status = currentRide->status == RideStatus::simulating ? RideStatus::closed
: RideStatus::simulating;
auto gameAction = GameActions::RideSetStatusAction(currentRide->id, status);
GameActions::Execute(&gameAction);
GameActions::Execute(&gameAction, getGameState());
}
break;
}
@@ -2333,8 +2335,8 @@ namespace OpenRCT2::Ui::Windows
{
trackPlaceAction.SetCallback(RideConstructPlacedForwardGameActionCallback);
}
auto res = GameActions::Execute(&trackPlaceAction);
// Used by some functions
auto res = GameActions::Execute(&trackPlaceAction, getGameState());
if (res.Error != GameActions::Status::Ok)
{
_trackPlaceCost = kMoney64Undefined;
@@ -2350,7 +2352,8 @@ namespace OpenRCT2::Ui::Windows
{
return;
}
OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, trackPos);
Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, trackPos);
if (Network::GetMode() != Network::Mode::none)
{
@@ -2478,7 +2481,7 @@ namespace OpenRCT2::Ui::Windows
}
});
GameActions::Execute(&trackRemoveAction);
GameActions::Execute(&trackRemoveAction, getGameState());
}
void Rotate()
@@ -2576,7 +2579,7 @@ namespace OpenRCT2::Ui::Windows
trackSetBrakeSpeed.SetCallback([](const GameActions::GameAction* ga, const GameActions::Result* result) {
WindowRideConstructionUpdateActiveElements();
});
GameActions::Execute(&trackSetBrakeSpeed);
GameActions::Execute(&trackSetBrakeSpeed, getGameState());
return;
}
WindowRideConstructionUpdateActiveElements();
@@ -2692,7 +2695,7 @@ namespace OpenRCT2::Ui::Windows
ToolSet(*this, newToolWidgetIndex, Tool::crosshair);
}
});
auto res = GameActions::Execute(&rideEntranceExitPlaceAction);
auto res = GameActions::Execute(&rideEntranceExitPlaceAction, getGameState());
}
void DrawTrackPiece(
@@ -3709,7 +3712,7 @@ namespace OpenRCT2::Ui::Windows
auto gameAction = GameActions::MazeSetTrackAction(
CoordsXYZD{ _currentTrackBegin, 0 }, true, _currentRideIndex, GC_SET_MAZE_TRACK_BUILD);
auto mazeSetTrackResult = GameActions::Execute(&gameAction);
auto mazeSetTrackResult = GameActions::Execute(&gameAction, getGameState());
if (mazeSetTrackResult.Error == GameActions::Status::Ok)
{
_trackPlaceCost = mazeSetTrackResult.Cost;
@@ -4770,7 +4773,7 @@ namespace OpenRCT2::Ui::Windows
auto gameAction = GameActions::MazeSetTrackAction(
CoordsXYZD{ trackPos, 0 }, true, rideIndex, GC_SET_MAZE_TRACK_BUILD);
gameAction.SetFlags(flags);
auto result = GameActions::Execute(&gameAction);
auto result = GameActions::Execute(&gameAction, getGameState());
if (result.Error != GameActions::Status::Ok)
return kMoney64Undefined;
@@ -4789,7 +4792,7 @@ namespace OpenRCT2::Ui::Windows
liftHillAndAlternativeState, false);
trackPlaceAction.SetFlags(GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_NO_SPEND | GAME_COMMAND_FLAG_GHOST);
// This command must not be sent over the network
auto res = GameActions::Execute(&trackPlaceAction);
auto res = GameActions::Execute(&trackPlaceAction, getGameState());
if (res.Error != GameActions::Status::Ok)
return kMoney64Undefined;
@@ -5158,7 +5161,7 @@ namespace OpenRCT2::Ui::Windows
{
auto gameAction = GameActions::MazeSetTrackAction(quadrant, false, rideIndex, GC_SET_MAZE_TRACK_FILL);
gameAction.SetFlags(flags);
auto res = GameActions::Execute(&gameAction);
auto res = GameActions::Execute(&gameAction, getGameState());
}
}
else
@@ -5179,7 +5182,7 @@ namespace OpenRCT2::Ui::Windows
};
trackRemoveAction.SetFlags(
GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_NO_SPEND | GAME_COMMAND_FLAG_GHOST);
GameActions::Execute(&trackRemoveAction);
GameActions::Execute(&trackRemoveAction, getGameState());
}
}
}
+3 -3
View File
@@ -462,7 +462,7 @@ namespace OpenRCT2::Ui::Windows
if (_quickDemolishMode && Network::GetMode() != Network::Mode::client)
{
auto gameAction = GameActions::RideDemolishAction(selectedRideId, GameActions::RideModifyType::demolish);
GameActions::Execute(&gameAction);
GameActions::Execute(&gameAction, getGameState());
RefreshList();
}
else
@@ -1099,7 +1099,7 @@ namespace OpenRCT2::Ui::Windows
&& rideRef.getClassification() == static_cast<RideClassification>(page))
{
auto gameAction = GameActions::RideSetStatusAction(rideRef.id, RideStatus::closed);
GameActions::Execute(&gameAction);
GameActions::Execute(&gameAction, getGameState());
}
}
}
@@ -1112,7 +1112,7 @@ namespace OpenRCT2::Ui::Windows
if (rideRef.status != RideStatus::open && rideRef.getClassification() == static_cast<RideClassification>(page))
{
auto gameAction = GameActions::RideSetStatusAction(rideRef.id, RideStatus::open);
GameActions::Execute(&gameAction);
GameActions::Execute(&gameAction, getGameState());
}
}
}
+21 -18
View File
@@ -333,7 +333,7 @@ namespace OpenRCT2::Ui::Windows
const auto objectType = GetObjectTypeFromSceneryType(tabSelectedScenery.SceneryType);
auto action = GameActions::ScenerySetRestrictedAction(
objectType, tabSelectedScenery.EntryIndex, newStatus);
GameActions::Execute(&action);
GameActions::Execute(&action, getGameState());
}
break;
}
@@ -2092,7 +2092,7 @@ namespace OpenRCT2::Ui::Windows
auto smallSceneryPlaceAction = GameActions::SmallSceneryPlaceAction(
loc, quadrant, entryIndex, primaryColour, secondaryColour, tertiaryColour);
smallSceneryPlaceAction.SetFlags(GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED);
auto res = GameActions::Execute(&smallSceneryPlaceAction);
auto res = GameActions::Execute(&smallSceneryPlaceAction, getGameState());
if (res.Error != GameActions::Status::Ok)
return kMoney64Undefined;
@@ -2134,7 +2134,7 @@ namespace OpenRCT2::Ui::Windows
gSceneryGhostPosition = loc;
gSceneryGhostType |= SCENERY_GHOST_FLAG_1;
});
auto res = GameActions::Execute(&footpathAdditionPlaceAction);
auto res = GameActions::Execute(&footpathAdditionPlaceAction, getGameState());
if (res.Error != GameActions::Status::Ok)
return kMoney64Undefined;
@@ -2163,7 +2163,7 @@ namespace OpenRCT2::Ui::Windows
gSceneryGhostType |= SCENERY_GHOST_FLAG_2;
});
auto res = GameActions::Execute(&wallPlaceAction);
auto res = GameActions::Execute(&wallPlaceAction, getGameState());
if (res.Error != GameActions::Status::Ok)
return kMoney64Undefined;
@@ -2181,7 +2181,7 @@ namespace OpenRCT2::Ui::Windows
loc, entryIndex, primaryColour, secondaryColour, tertiaryColour);
sceneryPlaceAction.SetFlags(
GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_NO_SPEND);
auto res = GameActions::Execute(&sceneryPlaceAction);
auto res = GameActions::Execute(&sceneryPlaceAction, getGameState());
if (res.Error != GameActions::Status::Ok)
return kMoney64Undefined;
@@ -2214,7 +2214,7 @@ namespace OpenRCT2::Ui::Windows
auto bannerPlaceAction = GameActions::BannerPlaceAction(loc, entryIndex, primaryColour);
bannerPlaceAction.SetFlags(
GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_NO_SPEND);
auto res = GameActions::Execute(&bannerPlaceAction);
auto res = GameActions::Execute(&bannerPlaceAction, getGameState());
if (res.Error != GameActions::Status::Ok)
return kMoney64Undefined;
@@ -2235,6 +2235,7 @@ namespace OpenRCT2::Ui::Windows
ViewportInteractionItem::Scenery, ViewportInteractionItem::Wall, ViewportInteractionItem::LargeScenery,
ViewportInteractionItem::Banner);
auto info = GetMapCoordinatesFromPos(screenCoords, flag);
auto& gameState = getGameState();
switch (info.interactionType)
{
case ViewportInteractionItem::Scenery:
@@ -2250,7 +2251,7 @@ namespace OpenRCT2::Ui::Windows
{ info.Loc, info.Element->GetBaseZ() }, quadrant, info.Element->AsSmallScenery()->GetEntryIndex(),
_sceneryPrimaryColour, _scenerySecondaryColour, _sceneryTertiaryColour);
GameActions::Execute(&repaintScenery);
GameActions::Execute(&repaintScenery, gameState);
break;
}
case ViewportInteractionItem::Wall:
@@ -2265,7 +2266,7 @@ namespace OpenRCT2::Ui::Windows
{ info.Loc, info.Element->GetBaseZ(), info.Element->GetDirection() }, _sceneryPrimaryColour,
_scenerySecondaryColour, _sceneryTertiaryColour);
GameActions::Execute(&repaintScenery);
GameActions::Execute(&repaintScenery, gameState);
break;
}
case ViewportInteractionItem::LargeScenery:
@@ -2281,7 +2282,7 @@ namespace OpenRCT2::Ui::Windows
info.Element->AsLargeScenery()->GetSequenceIndex(), _sceneryPrimaryColour, _scenerySecondaryColour,
_sceneryTertiaryColour);
GameActions::Execute(&repaintScenery);
GameActions::Execute(&repaintScenery, gameState);
break;
}
case ViewportInteractionItem::Banner:
@@ -2296,7 +2297,7 @@ namespace OpenRCT2::Ui::Windows
{ info.Loc, info.Element->GetBaseZ(), info.Element->AsBanner()->GetPosition() },
_sceneryPrimaryColour);
GameActions::Execute(&repaintScenery);
GameActions::Execute(&repaintScenery, gameState);
}
}
break;
@@ -2958,6 +2959,8 @@ namespace OpenRCT2::Ui::Windows
uint16_t selectedScenery = selectedTab.EntryIndex;
CoordsXY gridPos;
auto& gameState = getGameState();
switch (sceneryType)
{
case SCENERY_TYPE_SMALL:
@@ -3036,7 +3039,7 @@ namespace OpenRCT2::Ui::Windows
auto smallSceneryPlaceAction = GameActions::SmallSceneryPlaceAction(
{ cur_grid_x, cur_grid_y, gSceneryPlaceZ, gSceneryPlaceRotation }, quadrant, selectedScenery,
_sceneryPrimaryColour, _scenerySecondaryColour, _sceneryTertiaryColour);
auto res = GameActions::Query(&smallSceneryPlaceAction);
auto res = GameActions::Query(&smallSceneryPlaceAction, gameState);
success = res.Error;
if (res.Error == GameActions::Status::Ok)
{
@@ -3067,7 +3070,7 @@ namespace OpenRCT2::Ui::Windows
Audio::Play3D(Audio::SoundId::PlaceItem, result->Position);
}
});
auto res = GameActions::Execute(&smallSceneryPlaceAction);
auto res = GameActions::Execute(&smallSceneryPlaceAction, gameState);
if (res.Error == GameActions::Status::Ok)
{
forceError = false;
@@ -3100,7 +3103,7 @@ namespace OpenRCT2::Ui::Windows
}
Audio::Play3D(Audio::SoundId::PlaceItem, result->Position);
});
auto res = GameActions::Execute(&footpathAdditionPlaceAction);
auto res = GameActions::Execute(&footpathAdditionPlaceAction, gameState);
break;
}
case SCENERY_TYPE_WALL:
@@ -3122,7 +3125,7 @@ namespace OpenRCT2::Ui::Windows
selectedScenery, { gridPos, gSceneryPlaceZ }, edges, _sceneryPrimaryColour, _scenerySecondaryColour,
_sceneryTertiaryColour);
auto res = GameActions::Query(&wallPlaceAction);
auto res = GameActions::Query(&wallPlaceAction, gameState);
if (res.Error == GameActions::Status::Ok)
{
break;
@@ -3152,7 +3155,7 @@ namespace OpenRCT2::Ui::Windows
Audio::Play3D(Audio::SoundId::PlaceItem, result->Position);
}
});
auto res = GameActions::Execute(&wallPlaceAction);
auto res = GameActions::Execute(&wallPlaceAction, gameState);
break;
}
case SCENERY_TYPE_LARGE:
@@ -3175,7 +3178,7 @@ namespace OpenRCT2::Ui::Windows
auto sceneryPlaceAction = GameActions::LargeSceneryPlaceAction(
loc, selectedScenery, _sceneryPrimaryColour, _scenerySecondaryColour, _sceneryTertiaryColour);
auto res = GameActions::Query(&sceneryPlaceAction);
auto res = GameActions::Query(&sceneryPlaceAction, gameState);
if (res.Error == GameActions::Status::Ok)
{
break;
@@ -3209,7 +3212,7 @@ namespace OpenRCT2::Ui::Windows
Audio::Play3D(Audio::SoundId::Error, { loc.x, loc.y, gSceneryPlaceZ });
}
});
auto res = GameActions::Execute(&sceneryPlaceAction);
auto res = GameActions::Execute(&sceneryPlaceAction, gameState);
break;
}
case SCENERY_TYPE_BANNER:
@@ -3231,7 +3234,7 @@ namespace OpenRCT2::Ui::Windows
ContextOpenDetailWindow(WD_BANNER, data.bannerId.ToUnderlying());
}
});
GameActions::Execute(&bannerPlaceAction);
GameActions::Execute(&bannerPlaceAction, gameState);
break;
}
}
+9 -5
View File
@@ -14,6 +14,7 @@
#include <openrct2-ui/interface/Widget.h>
#include <openrct2-ui/windows/Windows.h>
#include <openrct2/Game.h>
#include <openrct2/GameState.h>
#include <openrct2/SpriteIds.h>
#include <openrct2/actions/LargeSceneryRemoveAction.h>
#include <openrct2/actions/SignSetNameAction.h>
@@ -154,6 +155,8 @@ namespace OpenRCT2::Ui::Windows
Close();
return;
}
auto& gameState = getGameState();
switch (widgetIndex)
{
case WIDX_CLOSE:
@@ -173,14 +176,14 @@ namespace OpenRCT2::Ui::Windows
{
CoordsXYZD wallLocation = { bannerCoords, tileElement->GetBaseZ(), tileElement->GetDirection() };
auto wallRemoveAction = GameActions::WallRemoveAction(wallLocation);
GameActions::Execute(&wallRemoveAction);
GameActions::Execute(&wallRemoveAction, gameState);
}
else
{
auto sceneryRemoveAction = GameActions::LargeSceneryRemoveAction(
{ bannerCoords, tileElement->GetBaseZ(), tileElement->GetDirection() },
tileElement->AsLargeScenery()->GetSequenceIndex());
GameActions::Execute(&sceneryRemoveAction);
GameActions::Execute(&sceneryRemoveAction, gameState);
}
break;
}
@@ -206,6 +209,7 @@ namespace OpenRCT2::Ui::Windows
void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override
{
auto& gameState = getGameState();
switch (widgetIndex)
{
case WIDX_MAIN_COLOUR:
@@ -215,7 +219,7 @@ namespace OpenRCT2::Ui::Windows
_mainColour = ColourDropDownIndexToColour(dropdownIndex);
auto signSetStyleAction = GameActions::SignSetStyleAction(
GetBannerIndex(), _mainColour, _textColour, !_isSmall);
GameActions::Execute(&signSetStyleAction);
GameActions::Execute(&signSetStyleAction, gameState);
break;
}
case WIDX_TEXT_COLOUR:
@@ -225,7 +229,7 @@ namespace OpenRCT2::Ui::Windows
_textColour = ColourDropDownIndexToColour(dropdownIndex);
auto signSetStyleAction = GameActions::SignSetStyleAction(
GetBannerIndex(), _mainColour, _textColour, !_isSmall);
GameActions::Execute(&signSetStyleAction);
GameActions::Execute(&signSetStyleAction, gameState);
break;
}
default:
@@ -240,7 +244,7 @@ namespace OpenRCT2::Ui::Windows
if (widgetIndex == WIDX_SIGN_TEXT && !text.empty())
{
auto signSetNameAction = GameActions::SignSetNameAction(GetBannerIndex(), std::string(text));
GameActions::Execute(&signSetNameAction);
GameActions::Execute(&signSetNameAction, getGameState());
}
}
+9 -7
View File
@@ -375,6 +375,7 @@ namespace OpenRCT2::Ui::Windows
return;
}
auto& gameState = getGameState();
switch (widgetIndex)
{
case WIDX_PICKUP:
@@ -397,7 +398,7 @@ namespace OpenRCT2::Ui::Windows
ToolSet(*wind, WC_STAFF__WIDX_PICKUP, Tool::picker);
}
});
GameActions::Execute(&pickupAction);
GameActions::Execute(&pickupAction, gameState);
}
break;
case WIDX_FIRE:
@@ -455,6 +456,7 @@ namespace OpenRCT2::Ui::Windows
void OverviewOnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex)
{
auto& gameState = getGameState();
switch (widgetIndex)
{
case WIDX_LOCATE:
@@ -485,7 +487,7 @@ namespace OpenRCT2::Ui::Windows
auto staffSetPatrolAreaAction = GameActions::StaffSetPatrolAreaAction(
staff->Id, {}, GameActions::StaffSetPatrolAreaMode::ClearAll);
GameActions::Execute(&staffSetPatrolAreaAction);
GameActions::Execute(&staffSetPatrolAreaAction, gameState);
}
else
{
@@ -719,7 +721,7 @@ namespace OpenRCT2::Ui::Windows
ToolCancel();
gPickupPeepImage = ImageId();
});
GameActions::Execute(&pickupAction);
GameActions::Execute(&pickupAction, getGameState());
}
void OverviewToolAbort(WidgetIndex widgetIndex)
@@ -731,7 +733,7 @@ namespace OpenRCT2::Ui::Windows
EntityId::FromUnderlying(number),
{ _pickedPeepOldX, 0, 0 },
Network::GetCurrentPlayerId() };
GameActions::Execute(&pickupAction);
GameActions::Execute(&pickupAction, getGameState());
}
void OverviewViewportRotate()
@@ -748,7 +750,7 @@ namespace OpenRCT2::Ui::Windows
return;
auto gameAction = GameActions::StaffSetNameAction(EntityId::FromUnderlying(number), std::string{ text });
GameActions::Execute(&gameAction);
GameActions::Execute(&gameAction, getGameState());
}
#pragma endregion
@@ -815,7 +817,7 @@ namespace OpenRCT2::Ui::Windows
ObjectEntryIndex costume = _availableCostumes[dropdownIndex].index;
auto staffSetCostumeAction = GameActions::StaffSetCostumeAction(EntityId::FromUnderlying(number), costume);
GameActions::Execute(&staffSetCostumeAction);
GameActions::Execute(&staffSetCostumeAction, getGameState());
}
void OptionsPrepareDraw()
@@ -1102,7 +1104,7 @@ namespace OpenRCT2::Ui::Windows
uint8_t newOrders = staff->StaffOrders ^ (1 << orderId);
auto staffSetOrdersAction = GameActions::StaffSetOrdersAction(EntityId::FromUnderlying(number), newOrders);
GameActions::Execute(&staffSetOrdersAction);
GameActions::Execute(&staffSetOrdersAction, getGameState());
}
void ViewportInit()
+1 -1
View File
@@ -63,7 +63,7 @@ namespace OpenRCT2::Ui::Windows
case WIDX_YES:
{
auto staffFireAction = GameActions::StaffFireAction(EntityId::FromUnderlying(number));
GameActions::Execute(&staffFireAction);
GameActions::Execute(&staffFireAction, getGameState());
break;
}
case WIDX_CLOSE:
+9 -5
View File
@@ -234,7 +234,7 @@ namespace OpenRCT2::Ui::Windows
{
auto action = GameActions::StaffSetColourAction(
GetSelectedStaffType(), ColourDropDownIndexToColour(dropdownIndex));
GameActions::Execute(&action);
GameActions::Execute(&action, getGameState());
}
}
@@ -336,6 +336,8 @@ namespace OpenRCT2::Ui::Windows
void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override
{
int32_t i = screenCoords.y / kScrollableRowHeight;
auto& gameState = getGameState();
for (const auto& entry : _staffList)
{
if (i == 0)
@@ -343,11 +345,11 @@ namespace OpenRCT2::Ui::Windows
if (_quickFireMode)
{
auto staffFireAction = GameActions::StaffFireAction(entry.Id);
GameActions::Execute(&staffFireAction);
GameActions::Execute(&staffFireAction, gameState);
}
else
{
auto peep = getGameState().entities.GetEntity<Staff>(entry.Id);
auto peep = gameState.entities.GetEntity<Staff>(entry.Id);
if (peep != nullptr)
{
auto intent = Intent(WindowClass::Peep);
@@ -537,6 +539,8 @@ namespace OpenRCT2::Ui::Windows
else
costume = findPeepAnimationsIndexForType(animPeepType);
auto& gameState = getGameState();
auto hireStaffAction = GameActions::StaffHireNewAction(autoPosition, staffType, costume, staffOrders);
hireStaffAction.SetCallback([=](const GameActions::GameAction*, const GameActions::Result* res) -> void {
if (res->Error != GameActions::Status::Ok)
@@ -569,7 +573,7 @@ namespace OpenRCT2::Ui::Windows
ToolSet(*wind, WC_STAFF__WIDX_PICKUP, Tool::picker);
}
});
GameActions::Execute(&pickupAction);
GameActions::Execute(&pickupAction, getGameState());
}
else
{
@@ -580,7 +584,7 @@ namespace OpenRCT2::Ui::Windows
}
});
GameActions::Execute(&hireStaffAction);
GameActions::Execute(&hireStaffAction, gameState);
}
StaffType GetSelectedStaffType() const
+26 -25
View File
@@ -16,6 +16,7 @@
#include <openrct2-ui/interface/Widget.h>
#include <openrct2-ui/windows/Windows.h>
#include <openrct2/Game.h>
#include <openrct2/GameState.h>
#include <openrct2/Input.h>
#include <openrct2/SpriteIds.h>
#include <openrct2/actions/TileModifyAction.h>
@@ -1866,14 +1867,14 @@ static uint64_t PageDisabledWidgets[] = {
{
Guard::Assert(elementIndex >= 0 && elementIndex < windowTileInspectorElementCount, "elementIndex out of range");
auto modifyTile = GameActions::TileModifyAction(_toolMap, GameActions::TileModifyType::AnyRemove, elementIndex);
GameActions::Execute(&modifyTile);
GameActions::Execute(&modifyTile, getGameState());
}
void RotateElement(int32_t elementIndex)
{
Guard::Assert(elementIndex >= 0 && elementIndex < windowTileInspectorElementCount, "elementIndex out of range");
auto modifyTile = GameActions::TileModifyAction(_toolMap, GameActions::TileModifyType::AnyRotate, elementIndex);
GameActions::Execute(&modifyTile);
GameActions::Execute(&modifyTile, getGameState());
}
// Swap element with its parent
@@ -1885,14 +1886,14 @@ static uint64_t PageDisabledWidgets[] = {
if (!firstInRange || !secondInRange)
return;
auto modifyTile = GameActions::TileModifyAction(_toolMap, GameActions::TileModifyType::AnySwap, first, second);
GameActions::Execute(&modifyTile);
GameActions::Execute(&modifyTile, getGameState());
}
void SortElements()
{
Guard::Assert(_tileSelected, "No tile selected");
auto modifyTile = GameActions::TileModifyAction(_toolMap, GameActions::TileModifyType::AnySort);
GameActions::Execute(&modifyTile);
GameActions::Execute(&modifyTile, getGameState());
}
void CopyElement()
@@ -1917,55 +1918,55 @@ static uint64_t PageDisabledWidgets[] = {
{
auto modifyTile = GameActions::TileModifyAction(
_toolMap, GameActions::TileModifyType::AnyPaste, 0, 0, _copiedElement, _copiedBanner);
GameActions::Execute(&modifyTile);
GameActions::Execute(&modifyTile, getGameState());
}
void BaseHeightOffset(int16_t elementIndex, int8_t heightOffset)
{
auto modifyTile = GameActions::TileModifyAction(
_toolMap, GameActions::TileModifyType::AnyBaseHeightOffset, elementIndex, heightOffset);
GameActions::Execute(&modifyTile);
GameActions::Execute(&modifyTile, getGameState());
}
void SurfaceShowParkFences(bool showFences)
{
auto modifyTile = GameActions::TileModifyAction(
_toolMap, GameActions::TileModifyType::SurfaceShowParkFences, showFences);
GameActions::Execute(&modifyTile);
GameActions::Execute(&modifyTile, getGameState());
}
void SurfaceToggleCorner(int32_t cornerIndex)
{
auto modifyTile = GameActions::TileModifyAction(
_toolMap, GameActions::TileModifyType::SurfaceToggleCorner, cornerIndex);
GameActions::Execute(&modifyTile);
GameActions::Execute(&modifyTile, getGameState());
}
void SurfaceToggleDiagonal()
{
auto modifyTile = GameActions::TileModifyAction(_toolMap, GameActions::TileModifyType::SurfaceToggleDiagonal);
GameActions::Execute(&modifyTile);
GameActions::Execute(&modifyTile, getGameState());
}
void PathSetSloped(int32_t elementIndex, bool sloped)
{
auto modifyTile = GameActions::TileModifyAction(
_toolMap, GameActions::TileModifyType::PathSetSlope, elementIndex, sloped);
GameActions::Execute(&modifyTile);
GameActions::Execute(&modifyTile, getGameState());
}
void PathSetJunctionRailings(int32_t elementIndex, bool hasJunctionRailings)
{
auto modifyTile = GameActions::TileModifyAction(
_toolMap, GameActions::TileModifyType::PathSetJunctionRailings, elementIndex, hasJunctionRailings);
GameActions::Execute(&modifyTile);
GameActions::Execute(&modifyTile, getGameState());
}
void PathSetBroken(int32_t elementIndex, bool broken)
{
auto modifyTile = GameActions::TileModifyAction(
_toolMap, GameActions::TileModifyType::PathSetBroken, elementIndex, broken);
GameActions::Execute(&modifyTile);
GameActions::Execute(&modifyTile, getGameState());
}
void PathToggleEdge(int32_t elementIndex, int32_t cornerIndex)
@@ -1974,7 +1975,7 @@ static uint64_t PageDisabledWidgets[] = {
Guard::Assert(cornerIndex >= 0 && cornerIndex < 8, "cornerIndex out of range");
auto modifyTile = GameActions::TileModifyAction(
_toolMap, GameActions::TileModifyType::PathToggleEdge, elementIndex, cornerIndex);
GameActions::Execute(&modifyTile);
GameActions::Execute(&modifyTile, getGameState());
}
void EntranceMakeUsable(int32_t elementIndex)
@@ -1982,7 +1983,7 @@ static uint64_t PageDisabledWidgets[] = {
Guard::ArgumentInRange(elementIndex, 0, windowTileInspectorElementCount - 1);
auto modifyTile = GameActions::TileModifyAction(
_toolMap, GameActions::TileModifyType::EntranceMakeUsable, elementIndex);
GameActions::Execute(&modifyTile);
GameActions::Execute(&modifyTile, getGameState());
}
void WallSetSlope(int32_t elementIndex, int32_t slopeValue)
@@ -1991,21 +1992,21 @@ static uint64_t PageDisabledWidgets[] = {
Guard::Assert((slopeValue & 3) == slopeValue, "slopeValue doesn't match its mask");
auto modifyTile = GameActions::TileModifyAction(
_toolMap, GameActions::TileModifyType::WallSetSlope, elementIndex, slopeValue);
GameActions::Execute(&modifyTile);
GameActions::Execute(&modifyTile, getGameState());
}
void WallAnimationFrameOffset(int16_t elementIndex, int8_t animationFrameOffset)
{
auto modifyTile = GameActions::TileModifyAction(
_toolMap, GameActions::TileModifyType::WallSetAnimationFrame, elementIndex, animationFrameOffset);
GameActions::Execute(&modifyTile);
GameActions::Execute(&modifyTile, getGameState());
}
void TrackBlockHeightOffset(int32_t elementIndex, int8_t heightOffset)
{
auto modifyTile = GameActions::TileModifyAction(
_toolMap, GameActions::TileModifyType::TrackBaseHeightOffset, elementIndex, heightOffset);
GameActions::Execute(&modifyTile);
GameActions::Execute(&modifyTile, getGameState());
}
void TrackBlockSetLift(int32_t elementIndex, bool entireTrackBlock, bool chain)
@@ -2014,21 +2015,21 @@ static uint64_t PageDisabledWidgets[] = {
_toolMap,
entireTrackBlock ? GameActions::TileModifyType::TrackSetChainBlock : GameActions::TileModifyType::TrackSetChain,
elementIndex, chain);
GameActions::Execute(&modifyTile);
GameActions::Execute(&modifyTile, getGameState());
}
void TrackSetBrakeClosed(int32_t elementIndex, bool isClosed)
{
auto modifyTile = GameActions::TileModifyAction(
_toolMap, GameActions::TileModifyType::TrackSetBrake, elementIndex, isClosed);
GameActions::Execute(&modifyTile);
GameActions::Execute(&modifyTile, getGameState());
}
void TrackSetIndestructible(int32_t elementIndex, bool isIndestructible)
{
auto modifyTile = GameActions::TileModifyAction(
_toolMap, GameActions::TileModifyType::TrackSetIndestructible, elementIndex, isIndestructible);
GameActions::Execute(&modifyTile);
GameActions::Execute(&modifyTile, getGameState());
}
void QuarterTileSet(int32_t elementIndex, const int32_t quarterIndex)
@@ -2038,7 +2039,7 @@ static uint64_t PageDisabledWidgets[] = {
auto modifyTile = GameActions::TileModifyAction(
_toolMap, GameActions::TileModifyType::ScenerySetQuarterLocation, elementIndex,
(quarterIndex - GetCurrentRotation()) & 3);
GameActions::Execute(&modifyTile);
GameActions::Execute(&modifyTile, getGameState());
}
// ToggleQuadrantCollision?
@@ -2047,7 +2048,7 @@ static uint64_t PageDisabledWidgets[] = {
auto modifyTile = GameActions::TileModifyAction(
_toolMap, GameActions::TileModifyType::ScenerySetQuarterCollision, elementIndex,
(quadrantIndex + 2 - GetCurrentRotation()) & 3);
GameActions::Execute(&modifyTile);
GameActions::Execute(&modifyTile, getGameState());
}
void BannerToggleBlock(int32_t elementIndex, int32_t edgeIndex)
@@ -2057,7 +2058,7 @@ static uint64_t PageDisabledWidgets[] = {
edgeIndex = (edgeIndex - GetCurrentRotation()) & 3;
auto modifyTile = GameActions::TileModifyAction(
_toolMap, GameActions::TileModifyType::BannerToggleBlockingEdge, elementIndex, edgeIndex);
GameActions::Execute(&modifyTile);
GameActions::Execute(&modifyTile, getGameState());
}
void ToggleInvisibility(int32_t elementIndex)
@@ -2065,14 +2066,14 @@ static uint64_t PageDisabledWidgets[] = {
Guard::Assert(elementIndex >= 0 && elementIndex < windowTileInspectorElementCount, "elementIndex out of range");
auto modifyTile = GameActions::TileModifyAction(
_toolMap, GameActions::TileModifyType::AnyToggleInvisilibity, elementIndex);
GameActions::Execute(&modifyTile);
GameActions::Execute(&modifyTile, getGameState());
}
void WallSetAnimationIsBackwards(int32_t elementIndex, bool backwards)
{
auto modifyTile = GameActions::TileModifyAction(
_toolMap, GameActions::TileModifyType::WallSetAnimationIsBackwards, elementIndex, backwards);
GameActions::Execute(&modifyTile);
GameActions::Execute(&modifyTile, getGameState());
}
void OnPrepareDraw() override
+2 -1
View File
@@ -13,6 +13,7 @@
#include <openrct2-ui/windows/Windows.h>
#include <openrct2/Editor.h>
#include <openrct2/Game.h>
#include <openrct2/GameState.h>
#include <openrct2/Input.h>
#include <openrct2/ParkImporter.h>
#include <openrct2/PlatformEnvironment.h>
@@ -148,7 +149,7 @@ namespace OpenRCT2::Ui::Windows
windowMgr->CloseByClass(WindowClass::ScenarioSelect);
windowMgr->CloseByClass(WindowClass::ServerList);
auto loadOrQuitAction = GameActions::LoadOrQuitAction(GameActions::LoadOrQuitModes::OpenSavePrompt);
GameActions::Execute(&loadOrQuitAction);
GameActions::Execute(&loadOrQuitAction, getGameState());
}
break;
case WIDX_MULTIPLAYER:
+7 -5
View File
@@ -316,7 +316,7 @@ namespace OpenRCT2::Ui::Windows
if (Network::GetMode() != Network::Mode::client)
{
auto pauseToggleAction = GameActions::PauseToggleAction();
GameActions::Execute(&pauseToggleAction);
GameActions::Execute(&pauseToggleAction, getGameState());
_waitingForPause = true;
}
break;
@@ -425,6 +425,8 @@ namespace OpenRCT2::Ui::Windows
{
return;
}
auto& gameState = getGameState();
switch (widgetIndex)
{
case WIDX_FILE_MENU:
@@ -453,13 +455,13 @@ namespace OpenRCT2::Ui::Windows
{
auto loadOrQuitAction = GameActions::LoadOrQuitAction(
GameActions::LoadOrQuitModes::OpenSavePrompt, PromptMode::saveBeforeNewGame);
GameActions::Execute(&loadOrQuitAction);
GameActions::Execute(&loadOrQuitAction, gameState);
break;
}
case DDIDX_LOAD_GAME:
{
auto loadOrQuitAction = GameActions::LoadOrQuitAction(GameActions::LoadOrQuitModes::OpenSavePrompt);
GameActions::Execute(&loadOrQuitAction);
GameActions::Execute(&loadOrQuitAction, gameState);
break;
}
case DDIDX_SAVE_GAME:
@@ -513,7 +515,7 @@ namespace OpenRCT2::Ui::Windows
windowMgr->CloseByClass(WindowClass::TrackDeletePrompt);
auto loadOrQuitAction = GameActions::LoadOrQuitAction(
GameActions::LoadOrQuitModes::OpenSavePrompt, PromptMode::saveBeforeQuit);
GameActions::Execute(&loadOrQuitAction);
GameActions::Execute(&loadOrQuitAction, gameState);
break;
}
case DDIDX_EXIT_OPENRCT2:
@@ -1301,7 +1303,7 @@ namespace OpenRCT2::Ui::Windows
newSpeed = 8;
auto setSpeedAction = GameActions::GameSetSpeedAction(newSpeed);
GameActions::Execute(&setSpeedAction);
GameActions::Execute(&setSpeedAction, getGameState());
}
}
}
+4 -4
View File
@@ -225,7 +225,7 @@ namespace OpenRCT2::Ui::Windows
_hasPlacementGhost = true;
}
});
res = GameActions::Execute(&tdAction);
res = GameActions::Execute(&tdAction, getGameState());
cost = res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined;
VirtualFloorSetHeight(trackLoc.z);
@@ -318,7 +318,7 @@ namespace OpenRCT2::Ui::Windows
}
}
});
GameActions::Execute(&tdAction);
GameActions::Execute(&tdAction, getGameState());
}
void OnToolAbort(WidgetIndex widgetIndex) override
@@ -382,7 +382,7 @@ namespace OpenRCT2::Ui::Windows
{
auto tdAction = GameActions::TrackDesignAction({ _placementGhostLoc }, *_trackDesign);
tdAction.SetFlags(GAME_COMMAND_FLAG_NO_SPEND | GAME_COMMAND_FLAG_GHOST);
auto res = GameActions::Execute(&tdAction);
auto res = GameActions::Execute(&tdAction, getGameState());
if (res.Error != GameActions::Status::Ok)
{
_hasPlacementGhost = false;
@@ -708,7 +708,7 @@ namespace OpenRCT2::Ui::Windows
auto tdAction = GameActions::TrackDesignAction(
CoordsXYZD{ loc.x, loc.y, loc.z, _currentTrackPieceDirection }, *_trackDesign);
tdAction.SetFlags(newFlags);
res = GameActions::Query(&tdAction);
res = GameActions::Query(&tdAction, getGameState());
// If successful don't keep trying.
// If failure due to no money then increasing height only makes problem worse
+9 -6
View File
@@ -257,13 +257,15 @@ namespace OpenRCT2::Ui::Windows
auto offsetPos = screenPos - ScreenCoordsXY{ 0, gInputDragLast.y };
auto& gameState = getGameState();
if (offsetPos.y <= dx)
{
gInputDragLast.y += dx;
auto waterRaiseAction = GameActions::WaterRaiseAction(
{ gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y });
GameActions::Execute(&waterRaiseAction);
GameActions::Execute(&waterRaiseAction, gameState);
_waterToolRaiseCost = kMoney64Undefined;
_waterToolLowerCost = kMoney64Undefined;
@@ -279,7 +281,7 @@ namespace OpenRCT2::Ui::Windows
auto waterLowerAction = GameActions::WaterLowerAction(
{ gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y });
GameActions::Execute(&waterLowerAction);
GameActions::Execute(&waterLowerAction, gameState);
_waterToolRaiseCost = kMoney64Undefined;
_waterToolLowerCost = kMoney64Undefined;
@@ -296,6 +298,7 @@ namespace OpenRCT2::Ui::Windows
MapInvalidateSelectionRect();
auto* windowMgr = Ui::GetWindowManager();
auto& gameState = getGameState();
if (gCurrentToolId == Tool::upDownArrow)
{
@@ -307,10 +310,10 @@ namespace OpenRCT2::Ui::Windows
auto waterRaiseAction = GameActions::WaterRaiseAction(
{ gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y });
auto res = GameActions::Query(&waterLowerAction);
auto res = GameActions::Query(&waterLowerAction, gameState);
money64 lowerCost = res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined;
res = GameActions::Query(&waterRaiseAction);
res = GameActions::Query(&waterRaiseAction, gameState);
money64 raiseCost = res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined;
if (_waterToolRaiseCost != raiseCost || _waterToolLowerCost != lowerCost)
@@ -398,10 +401,10 @@ namespace OpenRCT2::Ui::Windows
auto waterRaiseAction = GameActions::WaterRaiseAction(
{ gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y });
auto res = GameActions::Query(&waterLowerAction);
auto res = GameActions::Query(&waterLowerAction, gameState);
money64 lowerCost = res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined;
res = GameActions::Query(&waterRaiseAction);
res = GameActions::Query(&waterRaiseAction, gameState);
money64 raiseCost = res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined;
if (_waterToolRaiseCost != raiseCost || _waterToolLowerCost != lowerCost)
+1 -1
View File
@@ -61,7 +61,7 @@ void CheatsReset()
void CheatsSet(CheatType cheatType, int64_t param1 /* = 0*/, int64_t param2 /* = 0*/)
{
auto cheatSetAction = GameActions::CheatSetAction(cheatType, param1, param2);
GameActions::Execute(&cheatSetAction);
GameActions::Execute(&cheatSetAction, getGameState());
}
template<typename T>
+3 -2
View File
@@ -238,16 +238,17 @@ namespace OpenRCT2::Editor
static void SetAllLandOwned()
{
auto& gameState = getGameState();
MapRange range = { 2 * kCoordsXYStep, 2 * kCoordsXYStep, (gameState.mapSize.x - 3) * kCoordsXYStep,
(gameState.mapSize.y - 3) * kCoordsXYStep };
auto landSetRightsAction = GameActions::LandSetRightsAction(range, GameActions::LandSetRightSetting::SetForSale);
landSetRightsAction.SetFlags(GAME_COMMAND_FLAG_NO_SPEND);
GameActions::Execute(&landSetRightsAction);
GameActions::Execute(&landSetRightsAction, gameState);
auto landBuyRightsAction = GameActions::LandBuyRightsAction(range, GameActions::LandBuyRightSetting::BuyLand);
landBuyRightsAction.SetFlags(GAME_COMMAND_FLAG_NO_SPEND);
GameActions::Execute(&landBuyRightsAction);
GameActions::Execute(&landBuyRightsAction, gameState);
}
static void AfterLoadCleanup(bool loadedFromSave)
+8 -6
View File
@@ -110,7 +110,7 @@ using namespace OpenRCT2;
void GameResetSpeed()
{
auto setSpeedAction = GameActions::GameSetSpeedAction(1);
GameActions::Execute(&setSpeedAction);
GameActions::Execute(&setSpeedAction, getGameState());
}
void GameIncreaseGameSpeed()
@@ -120,7 +120,7 @@ void GameIncreaseGameSpeed()
newSpeed = 8;
auto setSpeedAction = GameActions::GameSetSpeedAction(newSpeed);
GameActions::Execute(&setSpeedAction);
GameActions::Execute(&setSpeedAction, getGameState());
}
void GameReduceGameSpeed()
@@ -130,7 +130,7 @@ void GameReduceGameSpeed()
newSpeed = 4;
auto setSpeedAction = GameActions::GameSetSpeedAction(newSpeed);
GameActions::Execute(&setSpeedAction);
GameActions::Execute(&setSpeedAction, getGameState());
}
/**
@@ -679,12 +679,14 @@ static void NewGameWindowCallback(const utf8* path)
*/
void GameLoadOrQuitNoSavePrompt()
{
auto& gameState = getGameState();
switch (gSavePromptMode)
{
case PromptMode::saveBeforeLoad:
{
auto loadOrQuitAction = GameActions::LoadOrQuitAction(GameActions::LoadOrQuitModes::CloseSavePrompt);
GameActions::Execute(&loadOrQuitAction);
GameActions::Execute(&loadOrQuitAction, gameState);
ToolCancel();
if (gLegacyScene == LegacyScene::scenarioEditor)
{
@@ -703,7 +705,7 @@ void GameLoadOrQuitNoSavePrompt()
case PromptMode::saveBeforeQuit:
{
auto loadOrQuitAction = GameActions::LoadOrQuitAction(GameActions::LoadOrQuitModes::CloseSavePrompt);
GameActions::Execute(&loadOrQuitAction);
GameActions::Execute(&loadOrQuitAction, gameState);
ToolCancel();
if (gInputFlags.has(InputFlag::unk5))
{
@@ -724,7 +726,7 @@ void GameLoadOrQuitNoSavePrompt()
case PromptMode::saveBeforeNewGame:
{
auto loadOrQuitAction = GameActions::LoadOrQuitAction(GameActions::LoadOrQuitModes::CloseSavePrompt);
GameActions::Execute(&loadOrQuitAction);
GameActions::Execute(&loadOrQuitAction, gameState);
ToolCancel();
auto intent = Intent(WindowClass::ScenarioSelect);
intent.PutExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast<CloseCallback>(NewGameWindowCallback));
+3 -2
View File
@@ -812,7 +812,8 @@ namespace OpenRCT2
{
auto& replayQueue = _currentReplay->commands;
const auto currentTicks = getGameState().currentTicks;
auto& gameState = getGameState();
const auto currentTicks = gameState.currentTicks;
while (replayQueue.begin() != replayQueue.end())
{
@@ -838,7 +839,7 @@ namespace OpenRCT2
GameAction* action = command.action.get();
action->SetFlags(action->GetFlags() | GAME_COMMAND_FLAG_REPLAY);
GameActions::Result result = GameActions::Execute(action);
GameActions::Result result = GameActions::Execute(action, gameState);
if (result.Error == GameActions::Status::Ok)
{
isPositionValid = true;
+2 -4
View File
@@ -38,9 +38,8 @@ namespace OpenRCT2::GameActions
stream << DS_TAG(_spriteIndex);
}
Result BalloonPressAction::Query() const
Result BalloonPressAction::Query(GameState_t& gameState) const
{
auto& gameState = getGameState();
auto balloon = gameState.entities.TryGetEntity<Balloon>(_spriteIndex);
if (balloon == nullptr)
{
@@ -50,9 +49,8 @@ namespace OpenRCT2::GameActions
return Result();
}
Result BalloonPressAction::Execute() const
Result BalloonPressAction::Execute(GameState_t& gameState) const
{
auto& gameState = getGameState();
auto balloon = gameState.entities.TryGetEntity<Balloon>(_spriteIndex);
if (balloon == nullptr)
{
+2 -2
View File
@@ -27,7 +27,7 @@ namespace OpenRCT2::GameActions
uint16_t GetActionFlags() const override;
void Serialise(DataSerialiser& stream) override;
Result Query() const override;
Result Execute() const override;
Result Query(GameState_t& gameState) const override;
Result Execute(GameState_t& gameState) const override;
};
} // namespace OpenRCT2::GameActions
+2 -2
View File
@@ -51,7 +51,7 @@ namespace OpenRCT2::GameActions
stream << DS_TAG(_loc) << DS_TAG(_bannerType) << DS_TAG(_primaryColour);
}
Result BannerPlaceAction::Query() const
Result BannerPlaceAction::Query(GameState_t& gameState) const
{
auto res = Result();
res.Position.x = _loc.x + 16;
@@ -108,7 +108,7 @@ namespace OpenRCT2::GameActions
return res;
}
Result BannerPlaceAction::Execute() const
Result BannerPlaceAction::Execute(GameState_t& gameState) const
{
auto res = Result();
res.Position.x = _loc.x + 16;
+2 -2
View File
@@ -34,8 +34,8 @@ namespace OpenRCT2::GameActions
uint16_t GetActionFlags() const override;
void Serialise(DataSerialiser& stream) override;
Result Query() const override;
Result Execute() const override;
Result Query(GameState_t& gameState) const override;
Result Execute(GameState_t& gameState) const override;
private:
PathElement* GetValidPathElement() const;
+2 -2
View File
@@ -44,7 +44,7 @@ namespace OpenRCT2::GameActions
stream << DS_TAG(_loc);
}
Result BannerRemoveAction::Query() const
Result BannerRemoveAction::Query(GameState_t& gameState) const
{
auto res = Result();
res.Expenditure = ExpenditureType::landscaping;
@@ -93,7 +93,7 @@ namespace OpenRCT2::GameActions
return res;
}
Result BannerRemoveAction::Execute() const
Result BannerRemoveAction::Execute(GameState_t& gameState) const
{
auto res = Result();
res.Expenditure = ExpenditureType::landscaping;
+2 -2
View File
@@ -27,8 +27,8 @@ namespace OpenRCT2::GameActions
uint16_t GetActionFlags() const override;
void Serialise(DataSerialiser& stream) override;
Result Query() const override;
Result Execute() const override;
Result Query(GameState_t& gameState) const override;
Result Execute(GameState_t& gameState) const override;
private:
BannerElement* GetBannerElementAt() const;
@@ -44,12 +44,12 @@ namespace OpenRCT2::GameActions
stream << DS_TAG(_loc) << DS_TAG(_primaryColour);
}
Result BannerSetColourAction::Query() const
Result BannerSetColourAction::Query(GameState_t& gameState) const
{
return QueryExecute(false);
}
Result BannerSetColourAction::Execute() const
Result BannerSetColourAction::Execute(GameState_t& gameState) const
{
return QueryExecute(true);
}
+2 -2
View File
@@ -28,8 +28,8 @@ namespace OpenRCT2::GameActions
uint16_t GetActionFlags() const override;
void Serialise(DataSerialiser& stream) override;
Result Query() const override;
Result Execute() const override;
Result Query(GameState_t& gameState) const override;
Result Execute(GameState_t& gameState) const override;
private:
Result QueryExecute(bool isExecuting) const;
+2 -2
View File
@@ -45,7 +45,7 @@ namespace OpenRCT2::GameActions
stream << DS_TAG(_bannerIndex) << DS_TAG(_name);
}
Result BannerSetNameAction::Query() const
Result BannerSetNameAction::Query(GameState_t& gameState) const
{
auto banner = GetBanner(_bannerIndex);
if (banner == nullptr)
@@ -77,7 +77,7 @@ namespace OpenRCT2::GameActions
return Result();
}
Result BannerSetNameAction::Execute() const
Result BannerSetNameAction::Execute(GameState_t& gameState) const
{
auto banner = GetBanner(_bannerIndex);
if (banner == nullptr)
+2 -2
View File
@@ -28,7 +28,7 @@ namespace OpenRCT2::GameActions
uint16_t GetActionFlags() const override;
void Serialise(DataSerialiser& stream) override;
Result Query() const override;
Result Execute() const override;
Result Query(GameState_t& gameState) const override;
Result Execute(GameState_t& gameState) const override;
};
} // namespace OpenRCT2::GameActions
@@ -47,7 +47,7 @@ namespace OpenRCT2::GameActions
stream << DS_TAG(_type) << DS_TAG(_bannerIndex) << DS_TAG(_parameter);
}
Result BannerSetStyleAction::Query() const
Result BannerSetStyleAction::Query(GameState_t& gameState) const
{
StringId errorTitle = STR_CANT_REPAINT_THIS;
if (_type == BannerSetStyleType::NoEntry)
@@ -119,7 +119,7 @@ namespace OpenRCT2::GameActions
return res;
}
Result BannerSetStyleAction::Execute() const
Result BannerSetStyleAction::Execute(GameState_t& gameState) const
{
auto res = Result();
+2 -2
View File
@@ -39,7 +39,7 @@ namespace OpenRCT2::GameActions
uint16_t GetActionFlags() const override;
void Serialise(DataSerialiser& stream) override;
Result Query() const override;
Result Execute() const override;
Result Query(GameState_t& gameState) const override;
Result Execute(GameState_t& gameState) const override;
};
} // namespace OpenRCT2::GameActions
+8 -9
View File
@@ -74,7 +74,7 @@ namespace OpenRCT2::GameActions
stream << DS_TAG(_cheatType) << DS_TAG(_param1) << DS_TAG(_param2);
}
Result CheatSetAction::Query() const
Result CheatSetAction::Query(GameState_t& gameState) const
{
if (static_cast<uint32_t>(_cheatType) >= static_cast<uint32_t>(CheatType::Count))
{
@@ -102,9 +102,8 @@ namespace OpenRCT2::GameActions
return Result();
}
Result CheatSetAction::Execute() const
Result CheatSetAction::Execute(GameState_t& gameState) const
{
auto& gameState = getGameState();
auto* windowMgr = Ui::GetWindowManager();
switch (static_cast<CheatType>(_cheatType.id))
@@ -168,7 +167,7 @@ namespace OpenRCT2::GameActions
SetMoney(_param1);
break;
case CheatType::ClearLoan:
ClearLoan();
ClearLoan(gameState);
break;
case CheatType::SetGuestParameter:
SetGuestParameter(_param1, _param2);
@@ -230,7 +229,7 @@ namespace OpenRCT2::GameActions
gameState.cheats.neverendingMarketing = _param1 != 0;
break;
case CheatType::OpenClosePark:
ParkSetOpen(!Park::IsOpen(gameState.park));
ParkSetOpen(!Park::IsOpen(gameState.park), gameState);
break;
case CheatType::HaveFun:
gameState.scenarioOptions.objective.Type = Scenario::ObjectiveType::haveFun;
@@ -624,14 +623,14 @@ namespace OpenRCT2::GameActions
windowMgr->InvalidateByClass(WindowClass::BottomToolbar);
}
void CheatSetAction::ClearLoan() const
void CheatSetAction::ClearLoan(GameState_t& gameState) const
{
// First give money
AddMoney(getGameState().park.bankLoan);
// Then pay the loan
auto gameAction = ParkSetLoanAction(0.00_GBP);
ExecuteNested(&gameAction);
ExecuteNested(&gameAction, gameState);
}
void CheatSetAction::GenerateGuests(int32_t count) const
@@ -833,10 +832,10 @@ namespace OpenRCT2::GameActions
MapCountRemainingLandRights();
}
void CheatSetAction::ParkSetOpen(bool isOpen) const
void CheatSetAction::ParkSetOpen(bool isOpen, GameState_t& gameState) const
{
auto parkSetParameter = ParkSetParameterAction(isOpen ? ParkParameter::Open : ParkParameter::Close);
ExecuteNested(&parkSetParameter);
ExecuteNested(&parkSetParameter, gameState);
}
void CheatSetAction::CreateDucks(int count) const
+4 -4
View File
@@ -31,8 +31,8 @@ namespace OpenRCT2::GameActions
uint16_t GetActionFlags() const override;
void Serialise(DataSerialiser& stream) override;
Result Query() const override;
Result Execute() const override;
Result Query(GameState_t& gameState) const override;
Result Execute(GameState_t& gameState) const override;
private:
ParametersRange GetParameterRange(CheatType cheatType) const;
@@ -47,14 +47,14 @@ namespace OpenRCT2::GameActions
void SetScenarioNoMoney(bool enabled) const;
void SetMoney(money64 amount) const;
void AddMoney(money64 amount) const;
void ClearLoan() const;
void ClearLoan(GameState_t& gameState) const;
void GenerateGuests(int32_t count) const;
void SetGuestParameter(int32_t parameter, int32_t value) const;
void GiveObjectToGuests(int32_t object) const;
void RemoveAllGuests() const;
void SetStaffSpeed(uint8_t value) const;
void OwnAllLand() const;
void ParkSetOpen(bool isOpen) const;
void ParkSetOpen(bool isOpen, GameState_t& gameState) const;
void CreateDucks(int count) const;
void RemoveParkFences() const;
};
+20 -17
View File
@@ -51,14 +51,14 @@ namespace OpenRCT2::GameActions
stream << DS_TAG(_range) << DS_TAG(_itemsToClear);
}
Result ClearAction::Query() const
Result ClearAction::Query(GameState_t& gameState) const
{
return QueryExecute(false);
return QueryExecute(gameState, false);
}
Result ClearAction::Execute() const
Result ClearAction::Execute(GameState_t& gameState) const
{
return QueryExecute(true);
return QueryExecute(gameState, true);
}
Result ClearAction::CreateResult() const
@@ -75,7 +75,7 @@ namespace OpenRCT2::GameActions
return result;
}
Result ClearAction::QueryExecute(bool executing) const
Result ClearAction::QueryExecute(GameState_t& gameState, bool executing) const
{
auto result = CreateResult();
@@ -89,9 +89,9 @@ namespace OpenRCT2::GameActions
{
for (int32_t x = validRange.GetLeft(); x <= validRange.GetRight(); x += kCoordsXYStep)
{
if (LocationValid({ x, y }) && MapCanClearAt({ x, y }))
if (LocationValid({ x, y }) && MapCanClearAt(gameState, { x, y }))
{
auto cost = ClearSceneryFromTile({ x, y }, executing);
auto cost = ClearSceneryFromTile({ x, y }, executing, gameState);
if (cost != kMoney64Undefined)
{
noValidTiles = false;
@@ -108,7 +108,7 @@ namespace OpenRCT2::GameActions
if (_itemsToClear & CLEARABLE_ITEMS::kSceneryLarge)
{
ResetClearLargeSceneryFlag();
ResetClearLargeSceneryFlag(gameState);
}
if (noValidTiles)
@@ -121,7 +121,7 @@ namespace OpenRCT2::GameActions
return result;
}
money64 ClearAction::ClearSceneryFromTile(const CoordsXY& tilePos, bool executing) const
money64 ClearAction::ClearSceneryFromTile(const CoordsXY& tilePos, bool executing, GameState_t& gameState) const
{
// Pass down all flags.
TileElement* tileElement = nullptr;
@@ -146,7 +146,8 @@ namespace OpenRCT2::GameActions
auto footpathRemoveAction = FootpathRemoveAction({ tilePos, tileElement->GetBaseZ() });
footpathRemoveAction.SetFlags(GetFlags());
auto res = executing ? ExecuteNested(&footpathRemoveAction) : QueryNested(&footpathRemoveAction);
auto res = executing ? ExecuteNested(&footpathRemoveAction, gameState)
: QueryNested(&footpathRemoveAction, gameState);
if (res.Error == Status::Ok)
{
@@ -163,7 +164,8 @@ namespace OpenRCT2::GameActions
tileElement->AsSmallScenery()->GetEntryIndex());
removeSceneryAction.SetFlags(GetFlags());
auto res = executing ? ExecuteNested(&removeSceneryAction) : QueryNested(&removeSceneryAction);
auto res = executing ? ExecuteNested(&removeSceneryAction, gameState)
: QueryNested(&removeSceneryAction, gameState);
if (res.Error == Status::Ok)
{
@@ -179,7 +181,8 @@ namespace OpenRCT2::GameActions
auto wallRemoveAction = WallRemoveAction(wallLocation);
wallRemoveAction.SetFlags(GetFlags());
auto res = executing ? ExecuteNested(&wallRemoveAction) : QueryNested(&wallRemoveAction);
auto res = executing ? ExecuteNested(&wallRemoveAction, gameState)
: QueryNested(&wallRemoveAction, gameState);
if (res.Error == Status::Ok)
{
@@ -196,7 +199,8 @@ namespace OpenRCT2::GameActions
tileElement->AsLargeScenery()->GetSequenceIndex());
removeSceneryAction.SetFlags(GetFlags() | GAME_COMMAND_FLAG_TRACK_DESIGN);
auto res = executing ? ExecuteNested(&removeSceneryAction) : QueryNested(&removeSceneryAction);
auto res = executing ? ExecuteNested(&removeSceneryAction, gameState)
: QueryNested(&removeSceneryAction, gameState);
if (res.Error == Status::Ok)
{
@@ -214,9 +218,8 @@ namespace OpenRCT2::GameActions
return totalCost;
}
void ClearAction::ResetClearLargeSceneryFlag()
void ClearAction::ResetClearLargeSceneryFlag(GameState_t& gameState)
{
auto& gameState = getGameState();
// TODO: Improve efficiency of this
for (int32_t y = 0; y < gameState.mapSize.y; y++)
{
@@ -236,9 +239,9 @@ namespace OpenRCT2::GameActions
}
}
bool ClearAction::MapCanClearAt(const CoordsXY& location)
bool ClearAction::MapCanClearAt(const GameState_t& gameState, const CoordsXY& location)
{
return gLegacyScene == LegacyScene::scenarioEditor || getGameState().cheats.sandboxMode
return gLegacyScene == LegacyScene::scenarioEditor || gameState.cheats.sandboxMode
|| MapIsLocationOwnedOrHasRights(location);
}
} // namespace OpenRCT2::GameActions
+6 -6
View File
@@ -39,20 +39,20 @@ namespace OpenRCT2::GameActions
uint16_t GetActionFlags() const override;
void Serialise(DataSerialiser& stream) override;
Result Query() const override;
Result Execute() const override;
Result Query(GameState_t& gameState) const override;
Result Execute(GameState_t& gameState) const override;
private:
Result CreateResult() const;
Result QueryExecute(bool executing) const;
money64 ClearSceneryFromTile(const CoordsXY& tilePos, bool executing) const;
Result QueryExecute(GameState_t& gameState, bool executing) const;
money64 ClearSceneryFromTile(const CoordsXY& tilePos, bool executing, GameState_t& gameState) const;
/**
* Function to clear the flag that is set to prevent cost duplication
* when using the clear scenery tool with large scenery.
*/
static void ResetClearLargeSceneryFlag();
static void ResetClearLargeSceneryFlag(GameState_t& gameState);
static bool MapCanClearAt(const CoordsXY& location);
static bool MapCanClearAt(const GameState_t& gameState, const CoordsXY& location);
};
} // namespace OpenRCT2::GameActions
+2 -2
View File
@@ -48,13 +48,13 @@ namespace OpenRCT2::GameActions
stream << DS_TAG(_id) << DS_TAG(_json);
}
Result CustomAction::Query() const
Result CustomAction::Query(GameState_t& gameState) const
{
auto& scriptingEngine = GetContext()->GetScriptEngine();
return scriptingEngine.QueryOrExecuteCustomGameAction(*this, false);
}
Result CustomAction::Execute() const
Result CustomAction::Execute(GameState_t& gameState) const
{
auto& scriptingEngine = GetContext()->GetScriptEngine();
return scriptingEngine.QueryOrExecuteCustomGameAction(*this, true);
+2 -2
View File
@@ -33,8 +33,8 @@ namespace OpenRCT2::GameActions
uint16_t GetActionFlags() const override;
void Serialise(DataSerialiser& stream) override;
Result Query() const override;
Result Execute() const override;
Result Query(GameState_t& gameState) const override;
Result Execute(GameState_t& gameState) const override;
};
} // namespace OpenRCT2::GameActions
@@ -51,7 +51,7 @@ namespace OpenRCT2::GameActions
stream << DS_TAG(_loc) << DS_TAG(_entryIndex);
}
Result FootpathAdditionPlaceAction::Query() const
Result FootpathAdditionPlaceAction::Query(GameState_t& gameState) const
{
auto res = Result();
res.Expenditure = ExpenditureType::landscaping;
@@ -140,7 +140,7 @@ namespace OpenRCT2::GameActions
return res;
}
Result FootpathAdditionPlaceAction::Execute() const
Result FootpathAdditionPlaceAction::Execute(GameState_t& gameState) const
{
auto res = Result();
res.Position = _loc;
@@ -28,7 +28,7 @@ namespace OpenRCT2::GameActions
uint16_t GetActionFlags() const override;
void Serialise(DataSerialiser& stream) override;
Result Query() const override;
Result Execute() const override;
Result Query(GameState_t& gameState) const override;
Result Execute(GameState_t& gameState) const override;
};
} // namespace OpenRCT2::GameActions
@@ -46,7 +46,7 @@ namespace OpenRCT2::GameActions
stream << DS_TAG(_loc);
}
Result FootpathAdditionRemoveAction::Query() const
Result FootpathAdditionRemoveAction::Query(GameState_t& gameState) const
{
if (!LocationValid(_loc))
{
@@ -93,7 +93,7 @@ namespace OpenRCT2::GameActions
return res;
}
Result FootpathAdditionRemoveAction::Execute() const
Result FootpathAdditionRemoveAction::Execute(GameState_t& gameState) const
{
auto* pathElement = MapGetFootpathElement(_loc);
if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST))
@@ -27,7 +27,7 @@ namespace OpenRCT2::GameActions
uint16_t GetActionFlags() const override;
void Serialise(DataSerialiser& stream) override;
Result Query() const override;
Result Execute() const override;
Result Query(GameState_t& gameState) const override;
Result Execute(GameState_t& gameState) const override;
};
} // namespace OpenRCT2::GameActions
@@ -64,7 +64,7 @@ namespace OpenRCT2::GameActions
return GameAction::GetActionFlags();
}
Result FootpathLayoutPlaceAction::Query() const
Result FootpathLayoutPlaceAction::Query(GameState_t& gameState) const
{
auto res = Result();
res.Cost = 0;
@@ -96,7 +96,7 @@ namespace OpenRCT2::GameActions
return ElementInsertQuery(std::move(res));
}
Result FootpathLayoutPlaceAction::Execute() const
Result FootpathLayoutPlaceAction::Execute(GameState_t& gameState) const
{
auto res = Result();
res.Cost = 0;
@@ -35,8 +35,8 @@ namespace OpenRCT2::GameActions
uint16_t GetActionFlags() const override;
void Serialise(DataSerialiser& stream) override;
Result Query() const override;
Result Execute() const override;
Result Query(GameState_t& gameState) const override;
Result Execute(GameState_t& gameState) const override;
private:
Result ElementInsertQuery(Result res) const;
+2 -2
View File
@@ -73,7 +73,7 @@ namespace OpenRCT2::GameActions
<< DS_TAG(_constructFlags);
}
Result FootpathPlaceAction::Query() const
Result FootpathPlaceAction::Query(GameState_t& gameState) const
{
auto res = Result();
res.Cost = 0;
@@ -124,7 +124,7 @@ namespace OpenRCT2::GameActions
return ElementUpdateQuery(tileElement, std::move(res));
}
Result FootpathPlaceAction::Execute() const
Result FootpathPlaceAction::Execute(GameState_t& gameState) const
{
auto res = Result();
res.Cost = 0;
+2 -2
View File
@@ -34,8 +34,8 @@ namespace OpenRCT2::GameActions
uint16_t GetActionFlags() const override;
void Serialise(DataSerialiser& stream) override;
Result Query() const override;
Result Execute() const override;
Result Query(GameState_t& gameState) const override;
Result Execute(GameState_t& gameState) const override;
private:
Result ElementUpdateQuery(PathElement* pathElement, Result res) const;
@@ -47,7 +47,7 @@ namespace OpenRCT2::GameActions
stream << DS_TAG(_loc);
}
Result FootpathRemoveAction::Query() const
Result FootpathRemoveAction::Query(GameState_t& gameState) const
{
auto res = Result();
res.Cost = 0;
@@ -75,7 +75,7 @@ namespace OpenRCT2::GameActions
return res;
}
Result FootpathRemoveAction::Execute() const
Result FootpathRemoveAction::Execute(GameState_t& gameState) const
{
auto res = Result();
res.Cost = 0;
@@ -92,7 +92,7 @@ namespace OpenRCT2::GameActions
if (footpathElement != nullptr)
{
FootpathQueueChainReset();
auto bannerRes = RemoveBannersAtElement(_loc, footpathElement);
auto bannerRes = RemoveBannersAtElement(gameState, _loc, footpathElement);
if (bannerRes.Error == Status::Ok)
{
res.Cost += bannerRes.Cost;
@@ -102,7 +102,6 @@ namespace OpenRCT2::GameActions
TileElementRemove(footpathElement);
FootpathUpdateQueueChains();
auto& gameState = getGameState();
// Remove the spawn point (if there is one in the current tile)
gameState.peepSpawns.erase(
std::remove_if(
@@ -164,7 +163,8 @@ namespace OpenRCT2::GameActions
*
* rct2: 0x006BA23E
*/
Result FootpathRemoveAction::RemoveBannersAtElement(const CoordsXY& loc, TileElement* tileElement) const
Result FootpathRemoveAction::RemoveBannersAtElement(
GameState_t& gameState, const CoordsXY& loc, TileElement* tileElement) const
{
auto result = Result();
while (!(tileElement++)->IsLastForTile())
@@ -180,7 +180,8 @@ namespace OpenRCT2::GameActions
bool isGhost = tileElement->IsGhost();
auto bannerFlags = GetFlags() | (isGhost ? static_cast<uint32_t>(GAME_COMMAND_FLAG_GHOST) : 0);
bannerRemoveAction.SetFlags(bannerFlags);
auto res = ExecuteNested(&bannerRemoveAction);
auto res = ExecuteNested(&bannerRemoveAction, gameState);
// Ghost removal is free
if (res.Error == Status::Ok && !isGhost)
{
+3 -3
View File
@@ -28,12 +28,12 @@ namespace OpenRCT2::GameActions
uint16_t GetActionFlags() const override;
void Serialise(DataSerialiser& stream) override;
Result Query() const override;
Result Execute() const override;
Result Query(GameState_t& gameState) const override;
Result Execute(GameState_t& gameState) const override;
private:
TileElement* GetFootpathElement() const;
money64 GetRefundPrice(TileElement* footpathElement) const;
Result RemoveBannersAtElement(const CoordsXY& loc, TileElement* tileElement) const;
Result RemoveBannersAtElement(GameState_t& gameState, const CoordsXY& loc, TileElement* tileElement) const;
};
} // namespace OpenRCT2::GameActions
+14 -14
View File
@@ -142,7 +142,7 @@ namespace OpenRCT2::GameActions
Guard::Assert(action != nullptr);
Result result = Execute(action);
Result result = Execute(action, getGameState());
if (result.Error == Status::Ok && Network::GetMode() == Network::Mode::server)
{
// Relay this action to all other clients.
@@ -188,7 +188,7 @@ namespace OpenRCT2::GameActions
return false;
}
static Result QueryInternal(const GameAction* action, bool topLevel)
static Result QueryInternal(const GameAction* action, GameState_t& gameState, bool topLevel)
{
Guard::ArgumentNotNull(action);
@@ -204,7 +204,7 @@ namespace OpenRCT2::GameActions
return result;
}
auto result = action->Query();
auto result = action->Query(gameState);
if (result.Error == Status::Ok)
{
@@ -219,14 +219,14 @@ namespace OpenRCT2::GameActions
return result;
}
Result Query(const GameAction* action)
Result Query(const GameAction* action, GameState_t& gameState)
{
return QueryInternal(action, true);
return QueryInternal(action, gameState, true);
}
Result QueryNested(const GameAction* action)
Result QueryNested(const GameAction* action, GameState_t& gameState)
{
return QueryInternal(action, false);
return QueryInternal(action, gameState, false);
}
static const char* GetRealm()
@@ -283,7 +283,7 @@ namespace OpenRCT2::GameActions
Network::AppendServerLog(text);
}
static Result ExecuteInternal(const GameAction* action, bool topLevel)
static Result ExecuteInternal(const GameAction* action, GameState_t& gameState, bool topLevel)
{
Guard::ArgumentNotNull(action);
@@ -309,7 +309,7 @@ namespace OpenRCT2::GameActions
}
}
Result result = QueryInternal(action, topLevel);
Result result = QueryInternal(action, gameState, topLevel);
#ifdef ENABLE_SCRIPTING
if (result.Error == Status::Ok
&& ((Network::GetMode() == Network::Mode::none) || (flags & GAME_COMMAND_FLAG_NETWORKED)))
@@ -354,7 +354,7 @@ namespace OpenRCT2::GameActions
LogActionBegin(logContext, action);
// Execute the action, changing the game state
result = action->Execute();
result = action->Execute(gameState);
#ifdef ENABLE_SCRIPTING
if (result.Error == Status::Ok)
{
@@ -456,14 +456,14 @@ namespace OpenRCT2::GameActions
return result;
}
Result Execute(const GameAction* action)
Result Execute(const GameAction* action, GameState_t& gameState)
{
return ExecuteInternal(action, true);
return ExecuteInternal(action, gameState, true);
}
Result ExecuteNested(const GameAction* action)
Result ExecuteNested(const GameAction* action, GameState_t& gameState)
{
return ExecuteInternal(action, false);
return ExecuteInternal(action, gameState, false);
}
const char* GameAction::GetName() const
+11 -6
View File
@@ -17,6 +17,11 @@
#include <functional>
#include <memory>
namespace OpenRCT2
{
struct GameState_t;
}
namespace OpenRCT2::GameActions
{
namespace Flags
@@ -229,12 +234,12 @@ namespace OpenRCT2::GameActions
/**
* Query the result of the game action without changing the game state.
*/
virtual OpenRCT2::GameActions::Result Query() const = 0;
virtual Result Query(GameState_t& gameState) const = 0;
/**
* Apply the game action and change the game state.
*/
virtual OpenRCT2::GameActions::Result Execute() const = 0;
virtual Result Execute(GameState_t& gameState) const = 0;
bool LocationValid(const CoordsXY& coords) const;
};
@@ -282,11 +287,11 @@ namespace OpenRCT2::GameActions
GameAction::Ptr Clone(const GameAction* action);
// This should be used if a round trip is to be expected.
Result Query(const GameAction* action);
Result Execute(const GameAction* action);
Result Query(const GameAction* action, GameState_t& gameState);
Result Execute(const GameAction* action, GameState_t& gameState);
// This should be used from within game actions.
Result QueryNested(const GameAction* action);
Result ExecuteNested(const GameAction* action);
Result QueryNested(const GameAction* action, GameState_t& gameState);
Result ExecuteNested(const GameAction* action, GameState_t& gameState);
} // namespace OpenRCT2::GameActions
+2 -2
View File
@@ -37,7 +37,7 @@ namespace OpenRCT2::GameActions
stream << DS_TAG(_speed);
}
Result GameSetSpeedAction::Query() const
Result GameSetSpeedAction::Query(GameState_t& gameState) const
{
Result res = Result();
@@ -50,7 +50,7 @@ namespace OpenRCT2::GameActions
return res;
}
Result GameSetSpeedAction::Execute() const
Result GameSetSpeedAction::Execute(GameState_t& gameState) const
{
Result res = Result();
+2 -2
View File
@@ -27,8 +27,8 @@ namespace OpenRCT2::GameActions
uint16_t GetActionFlags() const override;
void Serialise(DataSerialiser& stream) override;
Result Query() const override;
Result Execute() const override;
Result Query(GameState_t& gameState) const override;
Result Execute(GameState_t& gameState) const override;
private:
bool IsValidSpeed(uint8_t speed) const;
+2 -4
View File
@@ -41,9 +41,8 @@ namespace OpenRCT2::GameActions
stream << DS_TAG(_peepId) << DS_TAG(_newFlags);
}
Result GuestSetFlagsAction::Query() const
Result GuestSetFlagsAction::Query(GameState_t& gameState) const
{
auto& gameState = getGameState();
auto* peep = gameState.entities.TryGetEntity<Guest>(_peepId);
if (peep == nullptr)
{
@@ -53,9 +52,8 @@ namespace OpenRCT2::GameActions
return Result();
}
Result GuestSetFlagsAction::Execute() const
Result GuestSetFlagsAction::Execute(GameState_t& gameState) const
{
auto& gameState = getGameState();
auto* peep = gameState.entities.TryGetEntity<Guest>(_peepId);
if (peep == nullptr)
{
+2 -2
View File
@@ -28,7 +28,7 @@ namespace OpenRCT2::GameActions
uint16_t GetActionFlags() const override;
void Serialise(DataSerialiser& stream) override;
Result Query() const override;
Result Execute() const override;
Result Query(GameState_t& gameState) const override;
Result Execute(GameState_t& gameState) const override;
};
} // namespace OpenRCT2::GameActions
+2 -2
View File
@@ -56,7 +56,7 @@ namespace OpenRCT2::GameActions
stream << DS_TAG(_spriteIndex) << DS_TAG(_name);
}
Result GuestSetNameAction::Query() const
Result GuestSetNameAction::Query(GameState_t& gameState) const
{
if (_spriteIndex.ToUnderlying() >= kMaxEntities || _spriteIndex.IsNull())
{
@@ -73,7 +73,7 @@ namespace OpenRCT2::GameActions
return Result();
}
Result GuestSetNameAction::Execute() const
Result GuestSetNameAction::Execute(GameState_t& gameState) const
{
auto guest = getGameState().entities.TryGetEntity<Guest>(_spriteIndex);
if (guest == nullptr)
+2 -2
View File
@@ -31,7 +31,7 @@ namespace OpenRCT2::GameActions
uint16_t GetActionFlags() const override;
void Serialise(DataSerialiser& stream) override;
Result Query() const override;
Result Execute() const override;
Result Query(GameState_t& gameState) const override;
Result Execute(GameState_t& gameState) const override;
};
} // namespace OpenRCT2::GameActions
+2 -2
View File
@@ -57,12 +57,12 @@ namespace OpenRCT2::GameActions
stream << DS_TAG(_range) << DS_TAG(_setting);
}
Result LandBuyRightsAction::Query() const
Result LandBuyRightsAction::Query(GameState_t& gameState) const
{
return QueryExecute(false);
}
Result LandBuyRightsAction::Execute() const
Result LandBuyRightsAction::Execute(GameState_t& gameState) const
{
return QueryExecute(true);
}
+2 -2
View File
@@ -41,8 +41,8 @@ namespace OpenRCT2::GameActions
uint16_t GetActionFlags() const override;
void Serialise(DataSerialiser& stream) override;
Result Query() const override;
Result Execute() const override;
Result Query(GameState_t& gameState) const override;
Result Execute(GameState_t& gameState) const override;
private:
Result QueryExecute(bool isExecuting) const;
+7 -6
View File
@@ -55,17 +55,17 @@ namespace OpenRCT2::GameActions
stream << DS_TAG(_coords) << DS_TAG(_range) << DS_TAG(_selectionType);
}
Result LandLowerAction::Query() const
Result LandLowerAction::Query(GameState_t& gameState) const
{
return QueryExecute(false);
return QueryExecute(gameState, false);
}
Result LandLowerAction::Execute() const
Result LandLowerAction::Execute(GameState_t& gameState) const
{
return QueryExecute(true);
return QueryExecute(gameState, true);
}
Result LandLowerAction::QueryExecute(bool isExecuting) const
Result LandLowerAction::QueryExecute(GameState_t& gameState, bool isExecuting) const
{
auto res = Result();
size_t tableRow = _selectionType;
@@ -125,7 +125,8 @@ namespace OpenRCT2::GameActions
auto landSetHeightAction = LandSetHeightAction({ x, y }, height, newSlope);
landSetHeightAction.SetFlags(GetFlags());
auto result = isExecuting ? ExecuteNested(&landSetHeightAction) : QueryNested(&landSetHeightAction);
auto result = isExecuting ? ExecuteNested(&landSetHeightAction, gameState)
: QueryNested(&landSetHeightAction, gameState);
if (result.Error == Status::Ok)
{
res.Cost += result.Cost;
+3 -3
View File
@@ -29,10 +29,10 @@ namespace OpenRCT2::GameActions
uint16_t GetActionFlags() const override;
void Serialise(DataSerialiser& stream) override;
Result Query() const override;
Result Execute() const override;
Result Query(GameState_t& gameState) const override;
Result Execute(GameState_t& gameState) const override;
private:
Result QueryExecute(bool isExecuting) const;
Result QueryExecute(GameState_t& gameState, bool isExecuting) const;
};
} // namespace OpenRCT2::GameActions
+7 -6
View File
@@ -56,17 +56,17 @@ namespace OpenRCT2::GameActions
stream << DS_TAG(_coords) << DS_TAG(_range) << DS_TAG(_selectionType);
}
Result LandRaiseAction::Query() const
Result LandRaiseAction::Query(GameState_t& gameState) const
{
return QueryExecute(false);
return QueryExecute(gameState, false);
}
Result LandRaiseAction::Execute() const
Result LandRaiseAction::Execute(GameState_t& gameState) const
{
return QueryExecute(true);
return QueryExecute(gameState, true);
}
Result LandRaiseAction::QueryExecute(bool isExecuting) const
Result LandRaiseAction::QueryExecute(GameState_t& gameState, bool isExecuting) const
{
auto res = Result();
size_t tableRow = _selectionType;
@@ -129,7 +129,8 @@ namespace OpenRCT2::GameActions
auto landSetHeightAction = LandSetHeightAction({ x, y }, height, newSlope);
landSetHeightAction.SetFlags(GetFlags());
auto result = isExecuting ? ExecuteNested(&landSetHeightAction) : QueryNested(&landSetHeightAction);
auto result = isExecuting ? ExecuteNested(&landSetHeightAction, gameState)
: QueryNested(&landSetHeightAction, gameState);
if (result.Error == Status::Ok)
{
res.Cost += result.Cost;
+3 -3
View File
@@ -29,10 +29,10 @@ namespace OpenRCT2::GameActions
uint16_t GetActionFlags() const override;
void Serialise(DataSerialiser& stream) override;
Result Query() const override;
Result Execute() const override;
Result Query(GameState_t& gameState) const override;
Result Execute(GameState_t& gameState) const override;
private:
Result QueryExecute(bool isExecuting) const;
Result QueryExecute(GameState_t& gameState, bool isExecuting) const;
};
} // namespace OpenRCT2::GameActions
+2 -3
View File
@@ -58,9 +58,8 @@ namespace OpenRCT2::GameActions
stream << DS_TAG(_coords) << DS_TAG(_height) << DS_TAG(_style);
}
Result LandSetHeightAction::Query() const
Result LandSetHeightAction::Query(GameState_t& gameState) const
{
auto& gameState = getGameState();
if (gameState.park.flags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES)
{
return Result(Status::Disallowed, STR_FORBIDDEN_BY_THE_LOCAL_AUTHORITY, kStringIdNone);
@@ -155,7 +154,7 @@ namespace OpenRCT2::GameActions
return res;
}
Result LandSetHeightAction::Execute() const
Result LandSetHeightAction::Execute(GameState_t& gameState) const
{
money64 cost = 0.00_GBP;
auto surfaceHeight = TileElementHeight(_coords);
+2 -2
View File
@@ -29,8 +29,8 @@ namespace OpenRCT2::GameActions
uint16_t GetActionFlags() const override;
void Serialise(DataSerialiser& stream) override;
Result Query() const override;
Result Execute() const override;
Result Query(GameState_t& gameState) const override;
Result Execute(GameState_t& gameState) const override;
private:
StringId CheckParameters() const;
+2 -2
View File
@@ -64,12 +64,12 @@ namespace OpenRCT2::GameActions
stream << DS_TAG(_range) << DS_TAG(_setting) << DS_TAG(_ownership);
}
Result LandSetRightsAction::Query() const
Result LandSetRightsAction::Query(GameState_t& gameState) const
{
return QueryExecute(false);
}
Result LandSetRightsAction::Execute() const
Result LandSetRightsAction::Execute(GameState_t& gameState) const
{
return QueryExecute(true);
}
+2 -2
View File
@@ -40,8 +40,8 @@ namespace OpenRCT2::GameActions
uint16_t GetActionFlags() const override;
void Serialise(DataSerialiser& stream) override;
Result Query() const override;
Result Execute() const override;
Result Query(GameState_t& gameState) const override;
Result Execute(GameState_t& gameState) const override;
private:
Result QueryExecute(bool isExecuting) const;
+67 -55
View File
@@ -60,18 +60,18 @@ namespace OpenRCT2::GameActions
stream << DS_TAG(_coords) << DS_TAG(_range) << DS_TAG(_selectionType) << DS_TAG(_isLowering);
}
Result LandSmoothAction::Query() const
Result LandSmoothAction::Query(GameState_t& gameState) const
{
return SmoothLand(false);
return SmoothLand(gameState, false);
}
Result LandSmoothAction::Execute() const
Result LandSmoothAction::Execute(GameState_t& gameState) const
{
return SmoothLand(true);
return SmoothLand(gameState, true);
}
Result LandSmoothAction::SmoothLandTile(
int32_t direction, bool isExecuting, const CoordsXY& loc, SurfaceElement* surfaceElement) const
GameState_t& gameState, int32_t direction, bool isExecuting, const CoordsXY& loc, SurfaceElement* surfaceElement) const
{
int32_t targetBaseZ = surfaceElement->BaseHeight;
int32_t slope = surfaceElement->GetSlope();
@@ -96,14 +96,15 @@ namespace OpenRCT2::GameActions
auto landSetHeightAction = LandSetHeightAction(loc, targetBaseZ, slope);
landSetHeightAction.SetFlags(GetFlags());
auto res = isExecuting ? ExecuteNested(&landSetHeightAction) : QueryNested(&landSetHeightAction);
auto res = isExecuting ? ExecuteNested(&landSetHeightAction, gameState) : QueryNested(&landSetHeightAction, gameState);
return res;
}
money64 LandSmoothAction::SmoothLandRowByEdge(
bool isExecuting, const CoordsXY& loc, int32_t expectedLandHeight1, int32_t expectedLandHeight2, int32_t stepX,
int32_t stepY, int32_t direction1, int32_t direction2, int32_t checkDirection1, int32_t checkDirection2) const
GameState_t& gameState, bool isExecuting, const CoordsXY& loc, int32_t expectedLandHeight1, int32_t expectedLandHeight2,
int32_t stepX, int32_t stepY, int32_t direction1, int32_t direction2, int32_t checkDirection1,
int32_t checkDirection2) const
{
uint8_t shouldContinue = 0xF;
int32_t landChangePerTile = _isLowering ? 2 : -2;
@@ -235,7 +236,8 @@ namespace OpenRCT2::GameActions
}
auto landSetHeightAction = LandSetHeightAction(nextLoc, targetBaseZ, slope);
landSetHeightAction.SetFlags(GetFlags());
auto res = isExecuting ? ExecuteNested(&landSetHeightAction) : QueryNested(&landSetHeightAction);
auto res = isExecuting ? ExecuteNested(&landSetHeightAction, gameState)
: QueryNested(&landSetHeightAction, gameState);
if (res.Error == Status::Ok)
{
totalCost += res.Cost;
@@ -245,8 +247,8 @@ namespace OpenRCT2::GameActions
}
money64 LandSmoothAction::SmoothLandRowByCorner(
bool isExecuting, const CoordsXY& loc, int32_t expectedLandHeight, int32_t stepX, int32_t stepY, int32_t direction,
int32_t checkDirection) const
GameState_t& gameState, bool isExecuting, const CoordsXY& loc, int32_t expectedLandHeight, int32_t stepX, int32_t stepY,
int32_t direction, int32_t checkDirection) const
{
bool shouldContinue = true;
money64 totalCost = 0;
@@ -315,15 +317,15 @@ namespace OpenRCT2::GameActions
if (stepX * stepY != 0)
{
totalCost += SmoothLandRowByCorner(
isExecuting, nextLoc, expectedLandHeight + (landChangePerTile / 2), 0, stepY, direction,
gameState, isExecuting, nextLoc, expectedLandHeight + (landChangePerTile / 2), 0, stepY, direction,
checkDirection ^ 3);
totalCost += SmoothLandRowByCorner(
isExecuting, nextLoc, expectedLandHeight + (landChangePerTile / 2), stepX, 0, direction,
gameState, isExecuting, nextLoc, expectedLandHeight + (landChangePerTile / 2), stepX, 0, direction,
checkDirection ^ 1);
}
expectedLandHeight += landChangePerTile;
// change land of current tile
auto result = SmoothLandTile(direction, isExecuting, nextLoc, surfaceElement);
auto result = SmoothLandTile(gameState, direction, isExecuting, nextLoc, surfaceElement);
if (result.Error == Status::Ok)
{
totalCost += result.Cost;
@@ -332,7 +334,7 @@ namespace OpenRCT2::GameActions
return totalCost;
}
Result LandSmoothAction::SmoothLand(bool isExecuting) const
Result LandSmoothAction::SmoothLand(GameState_t& gameState, bool isExecuting) const
{
const bool raiseLand = !_isLowering;
const int32_t selectionType = _selectionType;
@@ -369,7 +371,7 @@ namespace OpenRCT2::GameActions
int32_t z = std::clamp(
static_cast<uint8_t>(TileElementGetCornerHeight(surfaceElement, 2)), minHeight, maxHeight);
res.Cost += SmoothLandRowByCorner(
isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, -32, -32, 0, 2);
gameState, isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, -32, -32, 0, 2);
}
}
{ // bottom-left
@@ -379,7 +381,7 @@ namespace OpenRCT2::GameActions
int32_t z = std::clamp(
static_cast<uint8_t>(TileElementGetCornerHeight(surfaceElement, 3)), minHeight, maxHeight);
res.Cost += SmoothLandRowByCorner(
isExecuting, { validRange.GetLeft(), validRange.GetBottom() }, z, -32, 32, 1, 3);
gameState, isExecuting, { validRange.GetLeft(), validRange.GetBottom() }, z, -32, 32, 1, 3);
}
}
{ // bottom-right
@@ -389,7 +391,7 @@ namespace OpenRCT2::GameActions
int32_t z = std::clamp(
static_cast<uint8_t>(TileElementGetCornerHeight(surfaceElement, 0)), minHeight, maxHeight);
res.Cost += SmoothLandRowByCorner(
isExecuting, { validRange.GetRight(), validRange.GetBottom() }, z, 32, 32, 2, 0);
gameState, isExecuting, { validRange.GetRight(), validRange.GetBottom() }, z, 32, 32, 2, 0);
}
}
{ // top-right
@@ -399,7 +401,7 @@ namespace OpenRCT2::GameActions
int32_t z = std::clamp(
static_cast<uint8_t>(TileElementGetCornerHeight(surfaceElement, 1)), minHeight, maxHeight);
res.Cost += SmoothLandRowByCorner(
isExecuting, { validRange.GetRight(), validRange.GetTop() }, z, 32, -32, 3, 1);
gameState, isExecuting, { validRange.GetRight(), validRange.GetTop() }, z, 32, -32, 3, 1);
}
}
@@ -414,7 +416,8 @@ namespace OpenRCT2::GameActions
static_cast<uint8_t>(TileElementGetCornerHeight(surfaceElement, 3)), minHeight, maxHeight);
z2 = std::clamp(
static_cast<uint8_t>(TileElementGetCornerHeight(surfaceElement, 2)), minHeight, maxHeight);
res.Cost += SmoothLandRowByEdge(isExecuting, { validRange.GetLeft(), y }, z1, z2, -32, 0, 0, 1, 3, 2);
res.Cost += SmoothLandRowByEdge(
gameState, isExecuting, { validRange.GetLeft(), y }, z1, z2, -32, 0, 0, 1, 3, 2);
}
surfaceElement = MapGetSurfaceElementAt(CoordsXY{ validRange.GetRight(), y });
@@ -424,7 +427,8 @@ namespace OpenRCT2::GameActions
static_cast<uint8_t>(TileElementGetCornerHeight(surfaceElement, 1)), minHeight, maxHeight);
z2 = std::clamp(
static_cast<uint8_t>(TileElementGetCornerHeight(surfaceElement, 0)), minHeight, maxHeight);
res.Cost += SmoothLandRowByEdge(isExecuting, { validRange.GetRight(), y }, z1, z2, 32, 0, 2, 3, 1, 0);
res.Cost += SmoothLandRowByEdge(
gameState, isExecuting, { validRange.GetRight(), y }, z1, z2, 32, 0, 2, 3, 1, 0);
}
}
@@ -437,7 +441,8 @@ namespace OpenRCT2::GameActions
static_cast<uint8_t>(TileElementGetCornerHeight(surfaceElement, 1)), minHeight, maxHeight);
z2 = std::clamp(
static_cast<uint8_t>(TileElementGetCornerHeight(surfaceElement, 2)), minHeight, maxHeight);
res.Cost += SmoothLandRowByEdge(isExecuting, { x, validRange.GetTop() }, z1, z2, 0, -32, 0, 3, 1, 2);
res.Cost += SmoothLandRowByEdge(
gameState, isExecuting, { x, validRange.GetTop() }, z1, z2, 0, -32, 0, 3, 1, 2);
}
surfaceElement = MapGetSurfaceElementAt(CoordsXY{ x, validRange.GetBottom() });
@@ -447,7 +452,8 @@ namespace OpenRCT2::GameActions
static_cast<uint8_t>(TileElementGetCornerHeight(surfaceElement, 0)), minHeight, maxHeight);
z2 = std::clamp(
static_cast<uint8_t>(TileElementGetCornerHeight(surfaceElement, 3)), minHeight, maxHeight);
res.Cost += SmoothLandRowByEdge(isExecuting, { x, validRange.GetBottom() }, z1, z2, 0, 32, 1, 2, 0, 3);
res.Cost += SmoothLandRowByEdge(
gameState, isExecuting, { x, validRange.GetBottom() }, z1, z2, 0, 32, 1, 2, 0, 3);
}
}
break;
@@ -481,13 +487,16 @@ namespace OpenRCT2::GameActions
// Smooth the corners
int32_t z = MapGetCornerHeight(newBaseZ, newSlope, 2);
res.Cost += SmoothLandRowByCorner(
isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, -32, -32, 0, 2);
gameState, isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, -32, -32, 0, 2);
z = MapGetCornerHeight(newBaseZ, newSlope, 0);
res.Cost += SmoothLandRowByCorner(isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, 32, 32, 2, 0);
res.Cost += SmoothLandRowByCorner(
gameState, isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, 32, 32, 2, 0);
z = MapGetCornerHeight(newBaseZ, newSlope, 3);
res.Cost += SmoothLandRowByCorner(isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, -32, 32, 1, 3);
res.Cost += SmoothLandRowByCorner(
gameState, isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, -32, 32, 1, 3);
z = MapGetCornerHeight(newBaseZ, newSlope, 1);
res.Cost += SmoothLandRowByCorner(isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, 32, -32, 3, 1);
res.Cost += SmoothLandRowByCorner(
gameState, isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, 32, -32, 3, 1);
// Smooth the edges
switch (selectionType)
@@ -495,54 +504,54 @@ namespace OpenRCT2::GameActions
case MAP_SELECT_TYPE_CORNER_0:
z = MapGetCornerHeight(newBaseZ, newSlope, 0);
res.Cost += SmoothLandRowByCorner(
isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, 32, 0, 3, 0);
gameState, isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, 32, 0, 3, 0);
res.Cost += SmoothLandRowByCorner(
isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, 0, 32, 1, 0);
gameState, isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, 0, 32, 1, 0);
z = MapGetCornerHeight(newBaseZ, newSlope, 3);
res.Cost += SmoothLandRowByCorner(
isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, -32, 0, 0, 3);
gameState, isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, -32, 0, 0, 3);
z = MapGetCornerHeight(newBaseZ, newSlope, 1);
res.Cost += SmoothLandRowByCorner(
isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, 0, -32, 0, 1);
gameState, isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, 0, -32, 0, 1);
break;
case MAP_SELECT_TYPE_CORNER_1:
z = MapGetCornerHeight(newBaseZ, newSlope, 1);
res.Cost += SmoothLandRowByCorner(
isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, 32, 0, 2, 1);
gameState, isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, 32, 0, 2, 1);
res.Cost += SmoothLandRowByCorner(
isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, 0, -32, 0, 1);
gameState, isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, 0, -32, 0, 1);
z = MapGetCornerHeight(newBaseZ, newSlope, 2);
res.Cost += SmoothLandRowByCorner(
isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, -32, 0, 1, 2);
gameState, isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, -32, 0, 1, 2);
z = MapGetCornerHeight(newBaseZ, newSlope, 0);
res.Cost += SmoothLandRowByCorner(
isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, 0, 32, 1, 0);
gameState, isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, 0, 32, 1, 0);
break;
case MAP_SELECT_TYPE_CORNER_2:
z = MapGetCornerHeight(newBaseZ, newSlope, 2);
res.Cost += SmoothLandRowByCorner(
isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, -32, 0, 1, 2);
gameState, isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, -32, 0, 1, 2);
res.Cost += SmoothLandRowByCorner(
isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, 0, -32, 3, 2);
gameState, isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, 0, -32, 3, 2);
z = MapGetCornerHeight(newBaseZ, newSlope, 1);
res.Cost += SmoothLandRowByCorner(
isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, 32, 0, 2, 1);
gameState, isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, 32, 0, 2, 1);
z = MapGetCornerHeight(newBaseZ, newSlope, 3);
res.Cost += SmoothLandRowByCorner(
isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, 0, 32, 2, 3);
gameState, isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, 0, 32, 2, 3);
break;
case MAP_SELECT_TYPE_CORNER_3:
z = MapGetCornerHeight(newBaseZ, newSlope, 3);
res.Cost += SmoothLandRowByCorner(
isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, -32, 0, 0, 3);
gameState, isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, -32, 0, 0, 3);
res.Cost += SmoothLandRowByCorner(
isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, 0, 32, 2, 3);
gameState, isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, 0, 32, 2, 3);
z = MapGetCornerHeight(newBaseZ, newSlope, 0);
res.Cost += SmoothLandRowByCorner(
isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, 32, 0, 3, 0);
gameState, isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, 32, 0, 3, 0);
z = MapGetCornerHeight(newBaseZ, newSlope, 2);
res.Cost += SmoothLandRowByCorner(
isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, 0, -32, 3, 2);
gameState, isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, 0, -32, 3, 2);
break;
}
break;
@@ -599,29 +608,32 @@ namespace OpenRCT2::GameActions
uint8_t z4 = MapGetCornerHeight(newBaseZ, newSlope, c4);
// Smooth the edge at the top of the new slope
res.Cost += SmoothLandRowByEdge(
isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z1, z2, stepOffsets[edge].x,
gameState, isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z1, z2, stepOffsets[edge].x,
stepOffsets[edge].y, c3, c4, c1, c2);
// Smooth the edge at the bottom of the new slope
res.Cost += SmoothLandRowByEdge(
isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z3, z4, -stepOffsets[edge].x,
gameState, isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z3, z4, -stepOffsets[edge].x,
-stepOffsets[edge].y, c1, c2, c3, c4);
// Smooth corners
res.Cost += SmoothLandRowByCorner(
isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z1, -stepOffsets[edge].y, stepOffsets[edge].x,
c2, c1);
gameState, isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z1, -stepOffsets[edge].y,
stepOffsets[edge].x, c2, c1);
res.Cost += SmoothLandRowByCorner(
isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z2, stepOffsets[edge].y, -stepOffsets[edge].x,
c1, c2);
gameState, isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z2, stepOffsets[edge].y,
-stepOffsets[edge].x, c1, c2);
int32_t z = MapGetCornerHeight(newBaseZ, newSlope, 2);
res.Cost += SmoothLandRowByCorner(
isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, -32, -32, 0, 2);
gameState, isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, -32, -32, 0, 2);
z = MapGetCornerHeight(newBaseZ, newSlope, 0);
res.Cost += SmoothLandRowByCorner(isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, 32, 32, 2, 0);
res.Cost += SmoothLandRowByCorner(
gameState, isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, 32, 32, 2, 0);
z = MapGetCornerHeight(newBaseZ, newSlope, 3);
res.Cost += SmoothLandRowByCorner(isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, -32, 32, 1, 3);
res.Cost += SmoothLandRowByCorner(
gameState, isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, -32, 32, 1, 3);
z = MapGetCornerHeight(newBaseZ, newSlope, 1);
res.Cost += SmoothLandRowByCorner(isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, 32, -32, 3, 1);
res.Cost += SmoothLandRowByCorner(
gameState, isExecuting, { validRange.GetLeft(), validRange.GetTop() }, z, 32, -32, 3, 1);
break;
}
default:
@@ -635,13 +647,13 @@ namespace OpenRCT2::GameActions
{
auto raiseLandAction = LandRaiseAction({ _coords.x, _coords.y }, validRange, selectionType);
raiseLandAction.SetFlags(GetFlags());
result = isExecuting ? ExecuteNested(&raiseLandAction) : QueryNested(&raiseLandAction);
result = isExecuting ? ExecuteNested(&raiseLandAction, gameState) : QueryNested(&raiseLandAction, gameState);
}
else
{
auto lowerLandAction = LandLowerAction({ _coords.x, _coords.y }, validRange, selectionType);
lowerLandAction.SetFlags(GetFlags());
result = isExecuting ? ExecuteNested(&lowerLandAction) : QueryNested(&lowerLandAction);
result = isExecuting ? ExecuteNested(&lowerLandAction, gameState) : QueryNested(&lowerLandAction, gameState);
}
if (result.Error != Status::Ok)
{
+11 -8
View File
@@ -35,17 +35,20 @@ namespace OpenRCT2::GameActions
uint16_t GetActionFlags() const override;
void Serialise(DataSerialiser& stream) override;
Result Query() const override;
Result Execute() const override;
Result Query(GameState_t& gameState) const override;
Result Execute(GameState_t& gameState) const override;
private:
Result SmoothLandTile(int32_t direction, bool isExecuting, const CoordsXY& loc, SurfaceElement* surfaceElement) const;
Result SmoothLandTile(
GameState_t& gameState, int32_t direction, bool isExecuting, const CoordsXY& loc,
SurfaceElement* surfaceElement) const;
money64 SmoothLandRowByEdge(
bool isExecuting, const CoordsXY& loc, int32_t expectedLandHeight1, int32_t expectedLandHeight2, int32_t stepX,
int32_t stepY, int32_t direction1, int32_t direction2, int32_t checkDirection1, int32_t checkDirection2) const;
GameState_t& gameState, bool isExecuting, const CoordsXY& loc, int32_t expectedLandHeight1,
int32_t expectedLandHeight2, int32_t stepX, int32_t stepY, int32_t direction1, int32_t direction2,
int32_t checkDirection1, int32_t checkDirection2) const;
money64 SmoothLandRowByCorner(
bool isExecuting, const CoordsXY& loc, int32_t expectedLandHeight, int32_t stepX, int32_t stepY, int32_t direction,
int32_t checkDirection) const;
Result SmoothLand(bool isExecuting) const;
GameState_t& gameState, bool isExecuting, const CoordsXY& loc, int32_t expectedLandHeight, int32_t stepX,
int32_t stepY, int32_t direction, int32_t checkDirection) const;
Result SmoothLand(GameState_t& gameState, bool isExecuting) const;
};
} // namespace OpenRCT2::GameActions
@@ -64,7 +64,7 @@ namespace OpenRCT2::GameActions
<< DS_TAG(_tertiaryColour);
}
Result LargeSceneryPlaceAction::Query() const
Result LargeSceneryPlaceAction::Query(GameState_t& gameState) const
{
auto res = Result();
res.ErrorTitle = STR_CANT_POSITION_THIS_HERE;
@@ -76,8 +76,6 @@ namespace OpenRCT2::GameActions
auto resultData = LargeSceneryPlaceActionResult{};
auto& gameState = getGameState();
money64 supportsCost = 0;
if (_primaryColour >= COLOUR_COUNT)
@@ -193,7 +191,7 @@ namespace OpenRCT2::GameActions
return res;
}
Result LargeSceneryPlaceAction::Execute() const
Result LargeSceneryPlaceAction::Execute(GameState_t& gameState) const
{
auto res = Result();
res.ErrorTitle = STR_CANT_POSITION_THIS_HERE;
@@ -47,8 +47,8 @@ namespace OpenRCT2::GameActions
uint16_t GetActionFlags() const override;
void Serialise(DataSerialiser& stream) override;
Result Query() const override;
Result Execute() const override;
Result Query(GameState_t& gameState) const override;
Result Execute(GameState_t& gameState) const override;
private:
bool CheckMapCapacity(std::span<const LargeSceneryTile> tiles, size_t numTiles) const;
@@ -49,7 +49,7 @@ namespace OpenRCT2::GameActions
stream << DS_TAG(_loc) << DS_TAG(_tileIndex);
}
Result LargeSceneryRemoveAction::Query() const
Result LargeSceneryRemoveAction::Query(GameState_t& gameState) const
{
auto res = Result();
@@ -129,7 +129,7 @@ namespace OpenRCT2::GameActions
return res;
}
Result LargeSceneryRemoveAction::Execute() const
Result LargeSceneryRemoveAction::Execute(GameState_t& gameState) const
{
auto res = Result();
@@ -28,8 +28,8 @@ namespace OpenRCT2::GameActions
uint16_t GetActionFlags() const override;
void Serialise(DataSerialiser& stream) override;
Result Query() const override;
Result Execute() const override;
Result Query(GameState_t& gameState) const override;
Result Execute(GameState_t& gameState) const override;
private:
TileElement* FindLargeSceneryElement(const CoordsXYZ& pos, int32_t sequenceIndex) const;
@@ -52,12 +52,12 @@ namespace OpenRCT2::GameActions
<< DS_TAG(_tertiaryColour);
}
Result LargeScenerySetColourAction::Query() const
Result LargeScenerySetColourAction::Query(GameState_t& gameState) const
{
return QueryExecute(false);
}
Result LargeScenerySetColourAction::Execute() const
Result LargeScenerySetColourAction::Execute(GameState_t& gameState) const
{
return QueryExecute(true);
}
@@ -32,8 +32,8 @@ namespace OpenRCT2::GameActions
uint16_t GetActionFlags() const override;
void Serialise(DataSerialiser& stream) override;
Result Query() const override;
Result Execute() const override;
Result Query(GameState_t& gameState) const override;
Result Execute(GameState_t& gameState) const override;
private:
Result QueryExecute(bool isExecuting) const;
+2 -2
View File
@@ -39,12 +39,12 @@ namespace OpenRCT2::GameActions
stream << DS_TAG(_mode) << DS_TAG(_savePromptMode);
}
Result LoadOrQuitAction::Query() const
Result LoadOrQuitAction::Query(GameState_t& gameState) const
{
return Result();
}
Result LoadOrQuitAction::Execute() const
Result LoadOrQuitAction::Execute(GameState_t& gameState) const
{
auto mode = static_cast<LoadOrQuitModes>(_mode);
switch (mode)
+2 -2
View File
@@ -35,7 +35,7 @@ namespace OpenRCT2::GameActions
uint16_t GetActionFlags() const override;
void Serialise(DataSerialiser& stream) override;
Result Query() const override;
Result Execute() const override;
Result Query(GameState_t& gameState) const override;
Result Execute(GameState_t& gameState) const override;
};
} // namespace OpenRCT2::GameActions
+2 -3
View File
@@ -43,7 +43,7 @@ namespace OpenRCT2::GameActions
stream << DS_TAG(_shift);
}
Result MapChangeSizeAction::Query() const
Result MapChangeSizeAction::Query(GameState_t& gameState) const
{
if (_targetSize.x > kMaximumMapSizeTechnical || _targetSize.y > kMaximumMapSizeTechnical)
{
@@ -56,9 +56,8 @@ namespace OpenRCT2::GameActions
return Result();
}
Result MapChangeSizeAction::Execute() const
Result MapChangeSizeAction::Execute(GameState_t& gameState) const
{
auto& gameState = getGameState();
// Expand map
while (_targetSize.x > gameState.mapSize.x)
{
+2 -2
View File
@@ -25,8 +25,8 @@ namespace OpenRCT2::GameActions
uint16_t GetActionFlags() const override;
void Serialise(DataSerialiser& stream) override;
Result Query() const override;
Result Execute() const override;
Result Query(GameState_t& gameState) const override;
Result Execute(GameState_t& gameState) const override;
private:
TileCoordsXY _targetSize;
@@ -45,7 +45,7 @@ namespace OpenRCT2::GameActions
stream << DS_TAG(_loc) << DS_TAG(_rideIndex) << DS_TAG(_mazeEntry);
}
Result MazePlaceTrackAction::Query() const
Result MazePlaceTrackAction::Query(GameState_t& gameState) const
{
auto res = Result();
@@ -65,7 +65,7 @@ namespace OpenRCT2::GameActions
res.ErrorMessage = STR_OFF_EDGE_OF_MAP;
return res;
}
auto& gameState = getGameState();
if (!MapIsLocationOwned(_loc) && !gameState.cheats.sandboxMode)
{
res.Error = Status::NotOwned;
@@ -142,7 +142,7 @@ namespace OpenRCT2::GameActions
return res;
}
Result MazePlaceTrackAction::Execute() const
Result MazePlaceTrackAction::Execute(GameState_t& gameState) const
{
auto res = Result();
Loaded 100 of 227 files, more files were not shown because too many files have changed in this diff. Show more