mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-24 17:46:03 +00:00
Add a button to the summary screen to replay the game that was just played (or replayed). Patch by Imarok, fixes #3437.
This was SVN commit r18031.
This commit is contained in:
@@ -50,6 +50,7 @@
|
||||
#include "ps/Hotkey.h"
|
||||
#include "ps/ProfileViewer.h"
|
||||
#include "ps/Pyrogenesis.h"
|
||||
#include "ps/Replay.h"
|
||||
#include "ps/SavedGame.h"
|
||||
#include "ps/UserReport.h"
|
||||
#include "ps/World.h"
|
||||
@@ -207,6 +208,16 @@ bool IsVisualReplay(ScriptInterface::CxPrivate* UNUSED(pCxPrivate))
|
||||
return g_Game ? g_Game->IsVisualReplay() : false;
|
||||
}
|
||||
|
||||
std::wstring GetCurrentReplayDirectory(ScriptInterface::CxPrivate* UNUSED(pCxPrivate))
|
||||
{
|
||||
if (!g_Game)
|
||||
return std::wstring();
|
||||
|
||||
return g_Game->IsVisualReplay() ?
|
||||
OsPath(g_Game->GetReplayPath()).Parent().Filename().string() :
|
||||
g_Game->GetReplayLogger().GetDirectory().Filename().string();
|
||||
}
|
||||
|
||||
int GetPlayerID(ScriptInterface::CxPrivate* UNUSED(pCxPrivate))
|
||||
{
|
||||
if (g_Game)
|
||||
@@ -1049,6 +1060,7 @@ void GuiScriptingInit(ScriptInterface& scriptInterface)
|
||||
// Misc functions
|
||||
scriptInterface.RegisterFunction<std::wstring, std::wstring, &SetCursor>("SetCursor");
|
||||
scriptInterface.RegisterFunction<bool, &IsVisualReplay>("IsVisualReplay");
|
||||
scriptInterface.RegisterFunction<std::wstring, &GetCurrentReplayDirectory>("GetCurrentReplayDirectory");
|
||||
scriptInterface.RegisterFunction<int, &GetPlayerID>("GetPlayerID");
|
||||
scriptInterface.RegisterFunction<void, int, &SetPlayerID>("SetPlayerID");
|
||||
scriptInterface.RegisterFunction<void, int, &SetViewedPlayer>("SetViewedPlayer");
|
||||
|
||||
Reference in New Issue
Block a user