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:
elexis
2016-04-14 14:45:03 +00:00
parent f4bfe7c3ad
commit a57bfc829e
6 changed files with 60 additions and 0 deletions
+12
View File
@@ -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");