mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-09-21 20:06:40 +00:00
Allow JS GUI pages to find out if the game is running.
Differential Revision: https://code.wildfiregames.com/D2289 Tested on: clang 8.0.1. This was SVN commit r22900.
This commit is contained in:
@@ -33,6 +33,11 @@
|
|||||||
|
|
||||||
extern void EndGame();
|
extern void EndGame();
|
||||||
|
|
||||||
|
bool JSI_Game::IsGameStarted(ScriptInterface::CxPrivate* UNUSED(pCxPrivate))
|
||||||
|
{
|
||||||
|
return g_Game;
|
||||||
|
}
|
||||||
|
|
||||||
void JSI_Game::StartGame(ScriptInterface::CxPrivate* pCxPrivate, JS::HandleValue attribs, int playerID)
|
void JSI_Game::StartGame(ScriptInterface::CxPrivate* pCxPrivate, JS::HandleValue attribs, int playerID)
|
||||||
{
|
{
|
||||||
ENSURE(!g_NetServer);
|
ENSURE(!g_NetServer);
|
||||||
@@ -162,6 +167,7 @@ void JSI_Game::DumpTerrainMipmap(ScriptInterface::CxPrivate* UNUSED(pCxPrivate))
|
|||||||
|
|
||||||
void JSI_Game::RegisterScriptFunctions(const ScriptInterface& scriptInterface)
|
void JSI_Game::RegisterScriptFunctions(const ScriptInterface& scriptInterface)
|
||||||
{
|
{
|
||||||
|
scriptInterface.RegisterFunction<bool, &IsGameStarted>("IsGameStarted");
|
||||||
scriptInterface.RegisterFunction<void, JS::HandleValue, int, &StartGame>("StartGame");
|
scriptInterface.RegisterFunction<void, JS::HandleValue, int, &StartGame>("StartGame");
|
||||||
scriptInterface.RegisterFunction<void, &Script_EndGame>("EndGame");
|
scriptInterface.RegisterFunction<void, &Script_EndGame>("EndGame");
|
||||||
scriptInterface.RegisterFunction<int, &GetPlayerID>("GetPlayerID");
|
scriptInterface.RegisterFunction<int, &GetPlayerID>("GetPlayerID");
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
namespace JSI_Game
|
namespace JSI_Game
|
||||||
{
|
{
|
||||||
|
bool IsGameStarted(ScriptInterface::CxPrivate* pCxPrivate);
|
||||||
void StartGame(ScriptInterface::CxPrivate* pCxPrivate, JS::HandleValue attribs, int playerID);
|
void StartGame(ScriptInterface::CxPrivate* pCxPrivate, JS::HandleValue attribs, int playerID);
|
||||||
void Script_EndGame(ScriptInterface::CxPrivate* pCxPrivate);
|
void Script_EndGame(ScriptInterface::CxPrivate* pCxPrivate);
|
||||||
int GetPlayerID(ScriptInterface::CxPrivate* pCxPrivate);
|
int GetPlayerID(ScriptInterface::CxPrivate* pCxPrivate);
|
||||||
|
|||||||
Reference in New Issue
Block a user