mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-23 11:53:04 +00:00
Send a network message to update the GUI if another player pauses a multiplayer game. Patch by echotangoecho, fixes #1950.
Pause animations then and on disconnect. Don't unpause unintentionally when closing a message box in singleplayer. This was SVN commit r18204.
This commit is contained in:
@@ -769,7 +769,7 @@ bool IsPaused(ScriptInterface::CxPrivate* pCxPrivate)
|
||||
}
|
||||
|
||||
// Pause/unpause the game
|
||||
void SetPaused(ScriptInterface::CxPrivate* pCxPrivate, bool pause)
|
||||
void SetPaused(ScriptInterface::CxPrivate* pCxPrivate, bool pause, bool sendMessage)
|
||||
{
|
||||
if (!g_Game)
|
||||
{
|
||||
@@ -781,6 +781,9 @@ void SetPaused(ScriptInterface::CxPrivate* pCxPrivate, bool pause)
|
||||
if (g_SoundManager)
|
||||
g_SoundManager->Pause(pause);
|
||||
#endif
|
||||
|
||||
if (g_NetClient && sendMessage)
|
||||
g_NetClient->SendPausedMessage(pause);
|
||||
}
|
||||
|
||||
// Return the global frames-per-second value.
|
||||
@@ -1083,7 +1086,7 @@ void GuiScriptingInit(ScriptInterface& scriptInterface)
|
||||
scriptInterface.RegisterFunction<JS::Value, &GetProfilerState>("GetProfilerState");
|
||||
scriptInterface.RegisterFunction<void, &ExitProgram>("Exit");
|
||||
scriptInterface.RegisterFunction<bool, &IsPaused>("IsPaused");
|
||||
scriptInterface.RegisterFunction<void, bool, &SetPaused>("SetPaused");
|
||||
scriptInterface.RegisterFunction<void, bool, bool, &SetPaused>("SetPaused");
|
||||
scriptInterface.RegisterFunction<int, &GetFps>("GetFPS");
|
||||
scriptInterface.RegisterFunction<std::wstring, int, &GetBuildTimestamp>("GetBuildTimestamp");
|
||||
scriptInterface.RegisterFunction<JS::Value, std::wstring, &ReadJSONFile>("ReadJSONFile");
|
||||
|
||||
Reference in New Issue
Block a user