Commit b21d5dc6 authored by Chen Bill's avatar Chen Bill

fix undo after replay swapping

parent e082f6e0
...@@ -277,7 +277,6 @@ void ReplayMode::Restart(bool refresh) { ...@@ -277,7 +277,6 @@ void ReplayMode::Restart(bool refresh) {
mainGame->dField.Clear(); mainGame->dField.Clear();
//mainGame->device->setEventReceiver(&mainGame->dField); //mainGame->device->setEventReceiver(&mainGame->dField);
cur_replay.Rewind(); cur_replay.Rewind();
//mainGame->dInfo.isFirst = true;
mainGame->dInfo.tag_player[0] = false; mainGame->dInfo.tag_player[0] = false;
mainGame->dInfo.tag_player[1] = false; mainGame->dInfo.tag_player[1] = false;
if(!StartDuel()) { if(!StartDuel()) {
...@@ -287,9 +286,14 @@ void ReplayMode::Restart(bool refresh) { ...@@ -287,9 +286,14 @@ void ReplayMode::Restart(bool refresh) {
mainGame->dField.RefreshAllCards(); mainGame->dField.RefreshAllCards();
mainGame->dInfo.isStarted = true; mainGame->dInfo.isStarted = true;
mainGame->dInfo.isFinished = false; mainGame->dInfo.isFinished = false;
//mainGame->dInfo.isReplay = true;
} }
skip_turn = 0; if (mainGame->dInfo.isReplaySwapped){
std::swap(mainGame->dInfo.lp[0], mainGame->dInfo.lp[1]);
std::swap(mainGame->dInfo.strLP[0], mainGame->dInfo.strLP[1]);
std::swap(mainGame->dInfo.hostname, mainGame->dInfo.clientname);
std::swap(mainGame->dInfo.hostname_tag, mainGame->dInfo.clientname_tag);
}
skip_turn = 0;
} }
void ReplayMode::Undo() { void ReplayMode::Undo() {
if(skip_step > 0 || current_step == 0) if(skip_step > 0 || current_step == 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment