1
0
forked from mirrors/0ad

Readd JS API function Engine.Exit()

Requested in #8244 for scripting purposes and automated testing. Extend
the original design by adding a means to pass an exit status. This also
comes in handy in case one wants to cleanly error out from JS on parsing
errors of command line arguments as reported in #7967.

Fixes: #8244
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
This commit is contained in:
Ralph Sennhauser
2025-11-12 19:21:27 +01:00
parent b5c4a4635c
commit 0d60bdfd2e
5 changed files with 18 additions and 14 deletions
+4 -1
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2025 Wildfire Games.
/* Copyright (C) 2026 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -47,6 +47,8 @@
class ScriptInterface;
extern void QuitEngine(int exitStatus);
namespace JSI_Main
{
bool AtlasIsAvailable()
@@ -134,6 +136,7 @@ std::string CalculateMD5(const std::string& input)
void RegisterScriptFunctions(const ScriptRequest& rq)
{
ScriptFunction::Register<&QuitEngine>(rq, "Exit");
ScriptFunction::Register<&AtlasIsAvailable>(rq, "AtlasIsAvailable");
ScriptFunction::Register<&IsAtlasRunning>(rq, "IsAtlasRunning");
ScriptFunction::Register<&OpenURL>(rq, "OpenURL");
+2 -2
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2026 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -25,7 +25,7 @@ bool IsQuitRequested()
return false;
}
void QuitEngine()
void QuitEngine(int)
{
}