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:
@@ -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");
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user