#3437 closed enhancement (fixed)
Add link from summary screen to replay
Reported by: | elexis | Owned by: | Imarok |
---|---|---|---|
Priority: | Nice to Have | Milestone: | Alpha 21 |
Component: | UI & Simulation | Keywords: | patch |
Cc: | Patch: |
Description
Adding a link to replay the game you just played (or replayed) to the summary screen would be great.
In case the user played a lobby game, it should display a message box confirming that the user wants to leave the lobby. Don't forget to actually end the XmppConnection
in that case.
Attachments (8)
Change History (21)
comment:1 by , 8 years ago
Keywords: | simple added |
---|
comment:2 by , 8 years ago
Owner: | set to |
---|
comment:3 by , 8 years ago
comment:4 by , 8 years ago
The replaylogger determines the filename in CReplayLogger::StartGame
of Replay.cpp
(which is called from CGame::StartGame
).
It should be sufficient to add a new function GetCurrentReplayFile
to ScriptFunctions.cpp
, which returns that path (likely need to add getter-function to access the path).
When session.js
is loaded, the game had been started already. So before ending the game in leaveGame
, you can learn the filename with Engine.GetCurrentReplayFile();
and pass it to the summary screen data created in that function.
The summary screen should have a new button to start the given replay.
In case of being connected to the lobby (Engine.HasXmppClient()
) you should either disconnect (Engine.StopXmppClient();
) before starting the replay or return to the lobby after it has ended.
comment:5 by , 8 years ago
This returns an absolute path like C:\Users\username\Documents\My Games\0ad\replays\0.0.21\2016-04-13_0008
I need just 2016-04-13_0008
Is there a way to get this relative path?
comment:7 by , 8 years ago
As it's an OsPath
, you should be able to use functions from path.h
like Parent
and Filename
. The latter looks like it would do that.
by , 8 years ago
Attachment: | replaybutton_v2.patch added |
---|
Adds a button which replays the game to the summary of a quit game or the summary preview of a replay
comment:8 by , 8 years ago
Keywords: | review patch added |
---|---|
Milestone: | Backlog → Alpha 21 |
by , 8 years ago
Attachment: | replaybutton_v3.patch added |
---|
Adds a button which replays the game to the summary of a quit game or the summary preview of a replay or the summary of a replay
by , 8 years ago
Attachment: | replaybutton_v3.1.patch added |
---|
Adds a button which replays the game to the summary of a quit game or the summary preview of a replay or the summary of a replay
by , 8 years ago
Attachment: | replaybutton_v3.2.patch added |
---|
Adds a button which replays the game to the summary of a quit game or the summary preview of a replay or the summary of a replay
by , 8 years ago
Attachment: | replaybutton_v3.3.patch added |
---|
Adds a button which replays the game to the summary of a quit game or the summary preview of a replay or the summary of a replay
follow-up: 10 comment:9 by , 8 years ago
Keywords: | simple removed |
---|
Thanks for the patch, few minor style issues remaining, then it should be ready to go:
- Since you need the directory but not the file, you should rename
GetCurrentReplayFile
toGetCurrentReplayDirectory
- Check for
if (!g_Game)
instead ofif (g_Game == NULL)
(as all the other places in that file do) - Return an empty string (
std::wstring()
) instead ofNULL
- The new scriptfunction seems to fit better below
IsVisualReplay
- (The other places in
Game.h
have the braces and the return in the same line, so you may or may not conform to this). - Adding the same sentence to the ticket for every uploaded patch doesn't help much.
As mentioned before in IRC:
- missing space:
"local":{
(wiki:Coding_Conventions) - If you are going to use a ternary operator there, then add a newline after
?
and:
, so that the conditions are easy to read (operators should be at the end of a newline, not in the beginning of the newline) (An if-return-return pattern like in the other scriptfunctions would also work)
comment:10 by , 8 years ago
Replying to elexis:
- Adding the same sentence to the ticket for every uploaded patch doesn't help much.
I thought this would be the sentence displayed in the changeset, when you add the patch to svn. So I just described the overall functionality of the patch, which hasn't changed since v3.
by , 8 years ago
Attachment: | rejoining_replay.patch added |
---|
Don't show the replay button when game was rejoined
How can I call the right replay in this situation?