mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-21 01:04:06 +00:00
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:
@@ -594,11 +594,18 @@ bool Init(const CmdLineArgs& args, int flags)
|
||||
// on anything else.)
|
||||
if (args.Has("dumpSchema"))
|
||||
{
|
||||
CSimulation2 sim{NULL, *g_ScriptContext, NULL};
|
||||
sim.LoadDefaultScripts();
|
||||
std::ofstream f("entity.rng", std::ios_base::out | std::ios_base::trunc);
|
||||
f << sim.GenerateSchema();
|
||||
debug_printf("Generated entity.rng\n");
|
||||
try
|
||||
{
|
||||
CSimulation2 sim{NULL, *g_ScriptContext, NULL};
|
||||
sim.LoadDefaultScripts();
|
||||
std::ofstream f("entity.rng", std::ios_base::out | std::ios_base::trunc);
|
||||
f << sim.GenerateSchema();
|
||||
debug_printf("Generated entity.rng\n");
|
||||
}
|
||||
catch (const CSimulation2::LoadScriptError& e)
|
||||
{
|
||||
LOGERROR("%s", e.what());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user