mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-10 09:32:29 +01:00
Always allow game state to be mutated in single player
This commit is contained in:
@@ -380,13 +380,24 @@ static std::string Stringify(duk_context* ctx, duk_idx_t idx)
|
||||
|
||||
bool OpenRCT2::Scripting::IsGameStateMutable()
|
||||
{
|
||||
// Allow single player to alter game state anywhere
|
||||
if (network_get_mode() == NETWORK_MODE_NONE)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
auto& scriptEngine = GetContext()->GetScriptEngine();
|
||||
auto& execInfo = scriptEngine.GetExecInfo();
|
||||
return execInfo.IsGameStateMutable();
|
||||
}
|
||||
}
|
||||
|
||||
void OpenRCT2::Scripting::ThrowIfGameStateNotMutable()
|
||||
{
|
||||
// Allow single player to alter game state anywhere
|
||||
if (network_get_mode() != NETWORK_MODE_NONE)
|
||||
{
|
||||
auto& scriptEngine = GetContext()->GetScriptEngine();
|
||||
auto& execInfo = scriptEngine.GetExecInfo();
|
||||
if (!execInfo.IsGameStateMutable())
|
||||
@@ -394,6 +405,7 @@ void OpenRCT2::Scripting::ThrowIfGameStateNotMutable()
|
||||
auto ctx = scriptEngine.GetContext();
|
||||
duk_error(ctx, DUK_ERR_ERROR, "Game state is not mutable in this context.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user