Commit 57c079a5 authored by DailyShana's avatar DailyShana

refine #1875

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