Skip to content
This repository has been archived by the owner on Apr 6, 2018. It is now read-only.

Commit

Permalink
sw_test
Browse files Browse the repository at this point in the history
  • Loading branch information
purerosefallen committed Feb 12, 2018
1 parent 8e98bfd commit dbb813a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions gframe/client_field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 7 additions & 0 deletions gframe/duelclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,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);
Expand Down Expand Up @@ -1085,6 +1086,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;
}
Expand Down
1 change: 1 addition & 0 deletions gframe/game.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ struct DuelInfo {
unsigned char time_player;
unsigned short time_limit;
unsigned short time_left[2];
bool isReplaySwapped;
};

struct BotInfo {
Expand Down

0 comments on commit dbb813a

Please sign in to comment.