Skip to content

Commit

Permalink
fix servergenerated replays
Browse files Browse the repository at this point in the history
if this is a reloaded game then we dont need to add [start]
  • Loading branch information
gfgtdf committed Jun 19, 2014
1 parent 7dfc376 commit 0e3b185
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/server/game.cpp
Expand Up @@ -1488,10 +1488,13 @@ void game::save_replay() {
<< "[/replay]\n"
<< "[replay_start]\n" << level_.output() << "[/replay_start]\n";
#else
const bool has_old_replay = level_.child("replay") != NULL;
//If there is already a replay in the level_, which means this is a reloaded game,
//then we dont need to add the [start] in the replay.
replay_data << level_.output()
//This can result in having 2 [replay] at toplevel since level_ can contain one already. But the client can handle this (simply merges them).
<< "[replay]\n"
<< "\t[command]\n\t\t[start]\n\t\t[/start]\n\t[/command]\n" //this is required by gfgtdf's sync mechanism, in PR 121
<< (has_old_replay ? "" : "\t[command]\n\t\t[start]\n\t\t[/start]\n\t[/command]\n") //this is required by gfgtdf's sync mechanism, in PR 121
<< replay_commands
<< "[/replay]\n";

Expand Down

0 comments on commit 0e3b185

Please sign in to comment.