1
0
forked from mirrors/0ad

Throw error when simulation script can't be loaded

When a script in "simulation/helpers/" contained an error. Files in
"simulation/components" aren't loaded. The return value of
`LoadDefaultScripts` indicated an error but was ignored. The simulation
still tried to start.

Now instead of returning a ignoreable error code the error is thrown. In
the common path the error is implicitly rethrown to the JS-function
which tried to start the game.

fixes: #8133
This commit is contained in:
phosit
2025-11-05 19:38:19 +01:00
parent 977bf5c0d1
commit 9a526bcae1
5 changed files with 44 additions and 29 deletions
@@ -320,7 +320,14 @@ ActorViewer::ActorViewer()
}
// Prepare the simulation
m.Simulation2.LoadDefaultScripts();
try
{
m.Simulation2.LoadDefaultScripts();
}
catch (const CSimulation2::LoadScriptError& e)
{
LOGERROR("%s", e.what());
}
m.Simulation2.ResetState();
// Set player data