Commit 39f8a45c authored by salix5's avatar salix5

Merge remote-tracking branch 'origin/master' into patch

parents 92082c55 65024f70
......@@ -1641,8 +1641,16 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->dField.grave[player].swap(mainGame->dField.deck[player]);
for (auto cit = mainGame->dField.grave[player].begin(); cit != mainGame->dField.grave[player].end(); ++cit)
(*cit)->location = LOCATION_GRAVE;
for (auto cit = mainGame->dField.deck[player].begin(); cit != mainGame->dField.deck[player].end(); ++cit)
(*cit)->location = LOCATION_DECK;
for (auto cit = mainGame->dField.deck[player].begin(); cit != mainGame->dField.deck[player].end(); ) {
if ((*cit)->type & 0x802040) {
(*cit)->location = LOCATION_EXTRA;
mainGame->dField.extra[player].push_back(*cit);
cit = mainGame->dField.deck[player].erase(cit);
} else {
(*cit)->location = LOCATION_DECK;
++cit;
}
}
} else {
mainGame->gMutex.Lock();
mainGame->dField.grave[player].swap(mainGame->dField.deck[player]);
......@@ -1650,9 +1658,17 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
(*cit)->location = LOCATION_GRAVE;
mainGame->dField.MoveCard(*cit, 10);
}
for (auto cit = mainGame->dField.deck[player].begin(); cit != mainGame->dField.deck[player].end(); ++cit) {
(*cit)->location = LOCATION_DECK;
mainGame->dField.MoveCard(*cit, 10);
for (auto cit = mainGame->dField.deck[player].begin(); cit != mainGame->dField.deck[player].end(); ) {
ClientCard* pcard = *cit;
if (pcard->type & 0x802040) {
pcard->location = LOCATION_EXTRA;
mainGame->dField.extra[player].push_back(pcard);
cit = mainGame->dField.deck[player].erase(cit);
} else {
pcard->location = LOCATION_DECK;
++cit;
}
mainGame->dField.MoveCard(pcard, 10);
}
mainGame->gMutex.Unlock();
mainGame->WaitFrameSignal(11);
......
......@@ -102,6 +102,10 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
DuelClient::StopClient();
mainGame->dInfo.isStarted = false;
mainGame->device->setEventReceiver(&mainGame->menuHandler);
mainGame->wCardImg->setVisible(false);
mainGame->wInfos->setVisible(false);
mainGame->wPhase->setVisible(false);
mainGame->btnLeaveGame->setVisible(false);
mainGame->btnCreateHost->setEnabled(true);
mainGame->btnJoinHost->setEnabled(true);
mainGame->btnJoinCancel->setEnabled(true);
......
......@@ -662,6 +662,7 @@ void Game::RefreshDeck(irr::gui::IGUIComboBox* cbDeck) {
BufferIO::DecodeUTF8(dirp->d_name, wname);
cbDeck->addItem(wname);
}
closedir(dir);
#endif
for(size_t i = 0; i < cbDeck->getItemCount(); ++i) {
if(!wcscmp(cbDeck->getItem(i), gameConf.lastdeck)) {
......@@ -697,6 +698,7 @@ void Game::RefreshReplay() {
if(Replay::CheckReplay(wname))
lstReplayList->addItem(wname);
}
closedir(dir);
#endif
}
void Game::RefreshSingleplay() {
......@@ -724,6 +726,7 @@ void Game::RefreshSingleplay() {
BufferIO::DecodeUTF8(dirp->d_name, wname);
lstSinglePlayList->addItem(wname);
}
closedir(dir);
#endif
}
void Game::LoadConfig() {
......
......@@ -568,9 +568,15 @@ void field::swap_deck_and_grave(uint8 playerid) {
(*clit)->enable_field_effect(false);
(*clit)->cancel_field_effect();
}
card_vector cl = player[playerid].list_grave;
player[playerid].list_grave = player[playerid].list_main;
player[playerid].list_main = cl;
player[playerid].list_grave.swap(player[playerid].list_main);
card_vector ex;
for(clit = player[playerid].list_main.begin(); clit != player[playerid].list_main.end(); ) {
if((*clit)->data.type & (TYPE_FUSION | TYPE_SYNCHRO | TYPE_XYZ)) {
ex.push_back(*clit);
clit = player[playerid].list_main.erase(clit);
} else
++clit;
}
for(clit = player[playerid].list_grave.begin(); clit != player[playerid].list_grave.end(); ++clit) {
(*clit)->current.location = LOCATION_GRAVE;
(*clit)->current.reason = REASON_EFFECT;
......@@ -587,7 +593,17 @@ void field::swap_deck_and_grave(uint8 playerid) {
(*clit)->apply_field_effect();
(*clit)->enable_field_effect(true);
}
for(clit = ex.begin(); clit != ex.end(); ++clit) {
(*clit)->current.location = LOCATION_EXTRA;
(*clit)->current.reason = REASON_EFFECT;
(*clit)->current.reason_effect = core.reason_effect;
(*clit)->current.reason_player = core.reason_player;
(*clit)->apply_field_effect();
(*clit)->enable_field_effect(true);
}
player[playerid].list_extra.insert(player[playerid].list_extra.end(), ex.begin(), ex.end());
reset_sequence(playerid, LOCATION_GRAVE);
reset_sequence(playerid, LOCATION_EXTRA);
pduel->write_buffer8(MSG_SWAP_GRAVE_DECK);
pduel->write_buffer8(playerid);
shuffle(playerid, LOCATION_DECK);
......
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