mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-24 00:03:11 +01:00
Merge pull request #20462 from ZehMatt/script-crash
Fix crashes when custom plugin actions fail due to immutable state
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
- Fix: [#9534] Screams no longer cut-off on steep diagonal drops
|
- Fix: [#9534] Screams no longer cut-off on steep diagonal drops
|
||||||
- Fix: [#19823] Parkobj: disallow overriding objects of different object types.
|
- Fix: [#19823] Parkobj: disallow overriding objects of different object types.
|
||||||
- Fix: [#20083] Cannot use terrain surfaces with ID > 32 and terrain edges with ID > 16.
|
- Fix: [#20083] Cannot use terrain surfaces with ID > 32 and terrain edges with ID > 16.
|
||||||
|
- Fix: [#20103] [Plugin] Crash when custom plugin actions fail due to immutable state.
|
||||||
- Fix: [#20111] All coaster types can access the new diagonal slope pieces.
|
- Fix: [#20111] All coaster types can access the new diagonal slope pieces.
|
||||||
- Fix: [#20155] Fairground organ style 2 shows up as regular music, rather than for the merry-go-round.
|
- Fix: [#20155] Fairground organ style 2 shows up as regular music, rather than for the merry-go-round.
|
||||||
- Fix: [#20260] Ride locks up when inspecting/fixing staff member is fired.
|
- Fix: [#20260] Ride locks up when inspecting/fixing staff member is fired.
|
||||||
|
|||||||
@@ -1109,20 +1109,28 @@ GameActions::Result ScriptEngine::QueryOrExecuteCustomGameAction(const CustomAct
|
|||||||
GameActions::Result ScriptEngine::DukToGameActionResult(const DukValue& d)
|
GameActions::Result ScriptEngine::DukToGameActionResult(const DukValue& d)
|
||||||
{
|
{
|
||||||
auto result = GameActions::Result();
|
auto result = GameActions::Result();
|
||||||
result.Error = static_cast<GameActions::Status>(AsOrDefault<int32_t>(d["error"]));
|
if (d.type() == DUK_TYPE_OBJECT)
|
||||||
result.ErrorTitle = AsOrDefault<std::string>(d["errorTitle"]);
|
|
||||||
result.ErrorMessage = AsOrDefault<std::string>(d["errorMessage"]);
|
|
||||||
result.Cost = AsOrDefault<int32_t>(d["cost"]);
|
|
||||||
|
|
||||||
auto expenditureType = AsOrDefault<std::string>(d["expenditureType"]);
|
|
||||||
if (!expenditureType.empty())
|
|
||||||
{
|
{
|
||||||
auto expenditure = StringToExpenditureType(expenditureType);
|
result.Error = static_cast<GameActions::Status>(AsOrDefault<int32_t>(d["error"]));
|
||||||
if (expenditure != ExpenditureType::Count)
|
result.ErrorTitle = AsOrDefault<std::string>(d["errorTitle"]);
|
||||||
|
result.ErrorMessage = AsOrDefault<std::string>(d["errorMessage"]);
|
||||||
|
result.Cost = AsOrDefault<int32_t>(d["cost"]);
|
||||||
|
auto expenditureType = AsOrDefault<std::string>(d["expenditureType"]);
|
||||||
|
if (!expenditureType.empty())
|
||||||
{
|
{
|
||||||
result.Expenditure = expenditure;
|
auto expenditure = StringToExpenditureType(expenditureType);
|
||||||
|
if (expenditure != ExpenditureType::Count)
|
||||||
|
{
|
||||||
|
result.Expenditure = expenditure;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result.Error = GameActions::Status::Unknown;
|
||||||
|
result.ErrorTitle = "Unknown";
|
||||||
|
result.ErrorMessage = "Unknown";
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user