diff --git a/src/openrct2/Editor.cpp b/src/openrct2/Editor.cpp index 263935083f..5642e25a82 100644 --- a/src/openrct2/Editor.cpp +++ b/src/openrct2/Editor.cpp @@ -57,7 +57,6 @@ #include using namespace OpenRCT2; -using OpenRCT2::GameActions::CommandFlag; namespace OpenRCT2::Editor { @@ -89,26 +88,6 @@ namespace OpenRCT2::Editor context->CloseProgress(); } - /** - * - * rct2: 0x0068ABEC - */ - 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({ CommandFlag::noSpend }); - GameActions::Execute(&landSetRightsAction, gameState); - - auto landBuyRightsAction = GameActions::LandBuyRightsAction(range, GameActions::LandBuyRightSetting::buyLand); - landBuyRightsAction.SetFlags({ CommandFlag::noSpend }); - GameActions::Execute(&landBuyRightsAction, gameState); - } - /** * * rct2: 0x006AB9B8 diff --git a/src/openrct2/Editor.h b/src/openrct2/Editor.h index 8b1045ceed..8bc4647f58 100644 --- a/src/openrct2/Editor.h +++ b/src/openrct2/Editor.h @@ -22,8 +22,6 @@ namespace OpenRCT2 namespace OpenRCT2::Editor { - void SetAllLandOwned(); - void ObjectListLoad(); ResultWithMessage CheckPark(); std::pair CheckObjectSelection(); diff --git a/src/openrct2/scenes/editor/EditorScene.cpp b/src/openrct2/scenes/editor/EditorScene.cpp index 5028705cbe..1370a24636 100644 --- a/src/openrct2/scenes/editor/EditorScene.cpp +++ b/src/openrct2/scenes/editor/EditorScene.cpp @@ -16,6 +16,10 @@ #include "../../GameState.h" #include "../../OpenRCT2.h" #include "../../ParkImporter.h" +#include "../../actions/GameActionRunner.h" +#include "../../actions/ResultWithMessage.h" +#include "../../actions/park/LandBuyRightsAction.h" +#include "../../actions/park/LandSetRightsAction.h" #include "../../audio/Audio.h" #include "../../core/Path.hpp" #include "../../drawing/Drawing.h" @@ -34,6 +38,7 @@ #include "../SceneManager.h" using namespace OpenRCT2; +using OpenRCT2::GameActions::CommandFlag; void EditorScene::Load() { @@ -311,3 +316,23 @@ void EditorScene::resetMainViewport() auto* mainWindow = WindowGetMain(); mainWindow->setViewportLocation(TileCoordsXYZ{ 75, 75, 14 }.ToCoordsXYZ()); } + +/** + * + * rct2: 0x0068ABEC + */ +void EditorScene::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({ CommandFlag::noSpend }); + GameActions::Execute(&landSetRightsAction, gameState); + + auto landBuyRightsAction = GameActions::LandBuyRightsAction(range, GameActions::LandBuyRightSetting::buyLand); + landBuyRightsAction.SetFlags({ CommandFlag::noSpend }); + GameActions::Execute(&landBuyRightsAction, gameState); +} diff --git a/src/openrct2/scenes/editor/EditorScene.h b/src/openrct2/scenes/editor/EditorScene.h index 64dfe7c07c..a9c6801d37 100644 --- a/src/openrct2/scenes/editor/EditorScene.h +++ b/src/openrct2/scenes/editor/EditorScene.h @@ -33,6 +33,9 @@ namespace OpenRCT2 static void FinaliseMainView(); static void resetMainViewport(); + protected: + void SetAllLandOwned(); + private: void AfterLoadCleanup(); void clearMapForEditing(); diff --git a/src/openrct2/scenes/editor/TrackDesignerScene.cpp b/src/openrct2/scenes/editor/TrackDesignerScene.cpp index 2f2ab8850e..f4c4ffbab2 100644 --- a/src/openrct2/scenes/editor/TrackDesignerScene.cpp +++ b/src/openrct2/scenes/editor/TrackDesignerScene.cpp @@ -34,7 +34,7 @@ void TrackDesignerScene::Load() auto& gameState = getGameState(); gameStateInitAll(gameState, kDefaultMapSize); gameState.editorStep = Editor::Step::objectSelection; - Editor::SetAllLandOwned(); + SetAllLandOwned(); Editor::ObjectListLoad(); ContextResetSubsystems(); diff --git a/src/openrct2/scenes/editor/TrackManagerScene.cpp b/src/openrct2/scenes/editor/TrackManagerScene.cpp index 44b58bf653..c28ab4505e 100644 --- a/src/openrct2/scenes/editor/TrackManagerScene.cpp +++ b/src/openrct2/scenes/editor/TrackManagerScene.cpp @@ -33,7 +33,7 @@ void TrackManagerScene::Load() auto& gameState = getGameState(); gameStateInitAll(gameState, kDefaultMapSize); - Editor::SetAllLandOwned(); + SetAllLandOwned(); gameState.editorStep = Editor::Step::objectSelection; Editor::ObjectListLoad(); ContextResetSubsystems();