Commit 181bc7af authored by mercury233's avatar mercury233

Merge branch 'master' of https://github.com/Fluorohydride/ygopro into server

parents 94843867 6258542b
...@@ -1764,13 +1764,15 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1764,13 +1764,15 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
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;
mainGame->dField.extra[player].push_back(*cit); mainGame->dField.AddCard(*cit, player, LOCATION_EXTRA, 0);
cit = mainGame->dField.deck[player].erase(cit); cit = mainGame->dField.deck[player].erase(cit);
} else { } else {
(*cit)->location = LOCATION_DECK; (*cit)->location = LOCATION_DECK;
(*cit)->sequence = m++;
++cit; ++cit;
} }
} }
...@@ -1781,14 +1783,16 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1781,14 +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;
mainGame->dField.extra[player].push_back(pcard); mainGame->dField.AddCard(pcard, player, LOCATION_EXTRA, 0);
cit = mainGame->dField.deck[player].erase(cit); cit = mainGame->dField.deck[player].erase(cit);
} else { } else {
pcard->location = LOCATION_DECK; pcard->location = LOCATION_DECK;
pcard->sequence = m++;
++cit; ++cit;
} }
mainGame->dField.MoveCard(pcard, 10); mainGame->dField.MoveCard(pcard, 10);
......
...@@ -962,7 +962,7 @@ void Game::LoadConfig() { ...@@ -962,7 +962,7 @@ void Game::LoadConfig() {
gameConf.serverport = atoi(valbuf); gameConf.serverport = atoi(valbuf);
} else if(!strcmp(strbuf, "lasthost")) { } else if(!strcmp(strbuf, "lasthost")) {
BufferIO::DecodeUTF8(valbuf, wstr); BufferIO::DecodeUTF8(valbuf, wstr);
BufferIO::CopyWStr(wstr, gameConf.lasthost, 20); BufferIO::CopyWStr(wstr, gameConf.lasthost, 100);
} else if(!strcmp(strbuf, "lastport")) { } else if(!strcmp(strbuf, "lastport")) {
BufferIO::DecodeUTF8(valbuf, wstr); BufferIO::DecodeUTF8(valbuf, wstr);
BufferIO::CopyWStr(wstr, gameConf.lastport, 20); BufferIO::CopyWStr(wstr, gameConf.lastport, 20);
......
...@@ -84,6 +84,7 @@ int main(int argc, char* argv[]) { ...@@ -84,6 +84,7 @@ int main(int argc, char* argv[]) {
if(!ygo::mainGame->Initialize()) if(!ygo::mainGame->Initialize())
return 0; return 0;
bool keep_on_return = false;
for(int i = 1; i < argc; ++i) { for(int i = 1; i < argc; ++i) {
if(argv[i][0] == '-' && argv[i][1] == 'e') { if(argv[i][0] == '-' && argv[i][1] == 'e') {
char param[128]; char param[128];
...@@ -120,8 +121,6 @@ int main(int argc, char* argv[]) { ...@@ -120,8 +121,6 @@ int main(int argc, char* argv[]) {
GetParameterW(param, &argv[i][0]); GetParameterW(param, &argv[i][0]);
ygo::mainGame->ebJoinPass->setText(param); ygo::mainGame->ebJoinPass->setText(param);
continue; continue;
} else if(!strcmp(argv[i], "-x")) { // eXit on return
exit_on_return = true;
} else if(!strcmp(argv[i], "-k")) { // Keep on return } else if(!strcmp(argv[i], "-k")) { // Keep on return
exit_on_return = false; exit_on_return = false;
keep_on_return = true; keep_on_return = true;
......
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