Commit 57c079a5 authored by DailyShana's avatar DailyShana

refine #1875

parent f03ab6c2
......@@ -1760,24 +1760,19 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
case MSG_SWAP_GRAVE_DECK: {
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int m = 0;
int e = mainGame->dField.extra[player].size();
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) {
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;
int m = 0;
for (auto cit = mainGame->dField.deck[player].begin(); cit != mainGame->dField.deck[player].end(); ) {
if ((*cit)->type & 0x802040) {
(*cit)->location = LOCATION_EXTRA;
(*cit)->position = POS_FACEDOWN;
(*cit)->sequence = e;
mainGame->dField.extra[player].push_back(*cit);
mainGame->dField.AddCard(*cit, player, LOCATION_EXTRA, 0);
cit = mainGame->dField.deck[player].erase(cit);
e++;
} else {
(*cit)->location = LOCATION_DECK;
(*cit)->sequence = m;
m++;
(*cit)->sequence = m++;
++cit;
}
}
......@@ -1788,19 +1783,16 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
(*cit)->location = LOCATION_GRAVE;
mainGame->dField.MoveCard(*cit, 10);
}
int m = 0;
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;
pcard->position = POS_FACEDOWN;
pcard->sequence = e;
mainGame->dField.extra[player].push_back(pcard);
mainGame->dField.AddCard(pcard, player, LOCATION_EXTRA, 0);
cit = mainGame->dField.deck[player].erase(cit);
e++;
} else {
pcard->location = LOCATION_DECK;
pcard->sequence = m;
m++;
pcard->sequence = m++;
++cit;
}
mainGame->dField.MoveCard(pcard, 10);
......
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