Part of #26654: Allow .parkpatch files to set rides to open

This commit is contained in:
Tulio Leao committed 2026-06-22 19:46:53 -03:00
1 parent 34df5c1001
commit d1d3044dac
1 file changed
+23
+23
View File
@@ -14,6 +14,7 @@
#include "../PlatformEnvironment.h"
#include "../actions/GameActionResult.h"
#include "../actions/footpath/FootpathPlaceAction.h"
#include "../actions/ride/RideSetStatusAction.h"
#include "../core/File.h"
#include "../core/Guard.hpp"
#include "../core/Json.hpp"
@@ -536,6 +537,24 @@ static void SwapRideEntranceAndExit(RideId rideId)
}
}
static void OpenRide(RideId rideId)
{
auto ride = GetRide(rideId);
if (ride == nullptr)
{
Guard::Assert(false, "Invalid Ride Id for OpenRide");
return;
}
auto rideOpenAction = GameActions::RideSetStatusAction(ride->id, RideStatus::open);
auto& gameState = getGameState();
auto result = rideOpenAction.Execute(gameState, gameState.park);
if (result.error != GameActions::Status::ok)
{
Guard::Assert(false, "Could not open ride %s", ride->getName().c_str());
}
}
static void ApplyRideFixes(const json_t& scenarioPatch)
{
if (!scenarioPatch.contains(_ridesKey))
@@ -582,6 +601,10 @@ static void ApplyRideFixes(const json_t& scenarioPatch)
{
SwapRideEntranceAndExit(rideId);
}
else if (operation == "open_ride")
{
OpenRide(rideId);
}
else
{
Guard::Assert(false, "Unsupported ride fix operation");