Skip to content

Commit

Permalink
more robust replaying
Browse files Browse the repository at this point in the history
  • Loading branch information
gfgtdf committed Apr 23, 2014
1 parent e2fc5d6 commit e689c37
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions src/replay.cpp
Expand Up @@ -814,12 +814,19 @@ REPLAY_RETURN do_replay_handle(int side_num)

else if (cfg->child("init_side"))
{

if(is_synced)
{
replay::process_error("found init_side in replay while is_synced=true\n" );
get_replay_source().revert_action();
//fits better than the other options, and should have the desired effect.
return REPLAY_FOUND_DEPENDENT;
}
else
{
set_scontext_synced sync;
resources::controller->do_init_side(side_num - 1, true);
}
set_scontext_synced sync;
resources::controller->do_init_side(side_num - 1, true);
}

//if there is an end turn directive
Expand All @@ -828,16 +835,22 @@ REPLAY_RETURN do_replay_handle(int side_num)
if(is_synced)
{
replay::process_error("found end_turn in replay while is_synced=true\n" );
get_replay_source().revert_action();
//fits better than the other options, and should have the desired effect.
return REPLAY_FOUND_DEPENDENT;
}
// During the original game, the undo stack would have been
// committed at this point.
resources::undo_stack->clear();
else
{
// During the original game, the undo stack would have been
// committed at this point.
resources::undo_stack->clear();

if (const config &child = cfg->child("verify")) {
verify(*resources::units, child);
}
if (const config &child = cfg->child("verify")) {
verify(*resources::units, child);
}

return REPLAY_FOUND_END_TURN;
return REPLAY_FOUND_END_TURN;
}
}
else if (const config &child = cfg->child("countdown_update"))
{
Expand Down

0 comments on commit e689c37

Please sign in to comment.