Commit bbbf15cd authored by nanahira's avatar nanahira Committed by mercury233

fix watch swap (#2085)

parent d530ec2f
......@@ -645,6 +645,7 @@ void ClientField::ReplaySwap() {
(*cit)->is_moving = false;
}
mainGame->dInfo.isFirst = !mainGame->dInfo.isFirst;
mainGame->dInfo.isReplaySwapped = !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);
......
......@@ -562,6 +562,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->dInfo.time_left[0] = 0;
mainGame->dInfo.time_left[1] = 0;
mainGame->dInfo.time_player = 2;
mainGame->dInfo.isReplaySwapped = false;
mainGame->is_building = false;
mainGame->wCardImg->setVisible(true);
mainGame->wInfos->setVisible(true);
......@@ -1050,6 +1051,12 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->dField.Initial(mainGame->LocalPlayer(1), deckc, extrac);
mainGame->dInfo.turn = 0;
mainGame->dInfo.is_shuffling = false;
if(mainGame->dInfo.isReplaySwapped) {
std::swap(mainGame->dInfo.hostname, mainGame->dInfo.clientname);
std::swap(mainGame->dInfo.hostname_tag, mainGame->dInfo.clientname_tag);
mainGame->dInfo.isReplaySwapped = false;
mainGame->dField.ReplaySwap();
}
mainGame->gMutex.Unlock();
return true;
}
......
......@@ -67,6 +67,7 @@ struct DuelInfo {
unsigned char time_player;
unsigned short time_limit;
unsigned short time_left[2];
bool isReplaySwapped;
};
struct BotInfo {
......
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