Commit b59c2224 authored by nanahira's avatar nanahira

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

parents f110d822 296ee7ae
......@@ -96,6 +96,7 @@ extern int enable_log;
extern bool exit_on_return;
extern bool open_file;
extern wchar_t open_file_name[256];
extern wchar_t open_file_name_with_category[256];
extern bool bot_mode;
#endif
......@@ -1468,7 +1468,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int c, l, s, ss;
unsigned int code;
bool panelmode = false;
int handcount = 0;
int hand_count[2] = { mainGame->dField.hand[0].size(), mainGame->dField.hand[1].size() };
int select_count_in_hand[2] = { 0, 0 };
bool select_ready = mainGame->dField.select_min == 0;
mainGame->dField.select_ready = select_ready;
ClientCard* pcard;
......@@ -1490,9 +1491,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pcard->is_selected = false;
if (l & 0xf1)
panelmode = true;
if(l & LOCATION_HAND) {
handcount++;
if(handcount >= 10)
if((l & LOCATION_HAND) && hand_count[c] >= 10) {
if(++select_count_in_hand[c] > 1)
panelmode = true;
}
}
......@@ -1533,6 +1533,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int c, l, s, ss;
unsigned int code;
bool panelmode = false;
int hand_count[2] = { mainGame->dField.hand[0].size(), mainGame->dField.hand[1].size() };
int select_count_in_hand[2] = { 0, 0 };
mainGame->dField.select_ready = false;
ClientCard* pcard;
for (int i = 0; i < count1; ++i) {
......@@ -1553,6 +1555,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pcard->is_selected = false;
if (l & 0xf1)
panelmode = true;
if((l & LOCATION_HAND) && hand_count[c] >= 10) {
if(++select_count_in_hand[c] > 1)
panelmode = true;
}
}
int count2 = BufferIO::ReadInt8(pbuf);
for (int i = count1; i < count1 + count2; ++i) {
......@@ -1573,6 +1579,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pcard->is_selected = true;
if (l & 0xf1)
panelmode = true;
if((l & LOCATION_HAND) && hand_count[c] >= 10) {
if(++select_count_in_hand[c] > 1)
panelmode = true;
}
}
std::sort(mainGame->dField.selectable_cards.begin(), mainGame->dField.selectable_cards.end(), ClientCard::client_card_sort);
if(select_hint)
......
......@@ -12,6 +12,7 @@ int enable_log = 0;
bool exit_on_return = false;
bool open_file = false;
wchar_t open_file_name[256] = L"";
wchar_t open_file_name_with_category[256] = L"";
bool bot_mode = false;
void ClickButton(irr::gui::IGUIElement* btn) {
......@@ -137,6 +138,7 @@ int main(int argc, char* argv[]) {
#endif //_WIN32
bool keep_on_return = false;
bool deckCategorySpecified = false;
for(int i = 1; i < wargc; ++i) {
if(wargv[i][0] == L'-' && wargv[i][1] == L'e' && wargv[i][2] != L'\0') {
ygo::dataManager.LoadDB(&wargv[i][2]);
......@@ -171,9 +173,16 @@ int main(int argc, char* argv[]) {
} else if(!wcscmp(wargv[i], L"-k")) { // Keep on return
exit_on_return = false;
keep_on_return = true;
} else if(!wcscmp(wargv[i], L"--deck-category")) {
++i;
if(i < wargc) {
deckCategorySpecified = true;
wcscpy(ygo::mainGame->gameConf.lastcategory, wargv[i]);
}
} else if(!wcscmp(wargv[i], L"-d")) { // Deck
++i;
ygo::mainGame->gameConf.lastcategory[0] = 0;
if(!deckCategorySpecified)
ygo::mainGame->gameConf.lastcategory[0] = 0;
if(i + 1 < wargc) { // select deck
wcscpy(ygo::mainGame->gameConf.lastdeck, wargv[i]);
continue;
......@@ -182,6 +191,11 @@ int main(int argc, char* argv[]) {
if(i < wargc) {
open_file = true;
wcscpy(open_file_name, wargv[i]);
if(deckCategorySpecified && wcslen(ygo::mainGame->gameConf.lastcategory)) {
swprintf(open_file_name_with_category, 256, L"%ls/%ls", ygo::mainGame->gameConf.lastcategory, open_file_name);
} else {
wcscpy(open_file_name_with_category, open_file_name);
}
}
ClickButton(ygo::mainGame->btnDeckEdit);
break;
......
......@@ -399,7 +399,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
}
case BUTTON_DECK_EDIT: {
mainGame->RefreshCategoryDeck(mainGame->cbDBCategory, mainGame->cbDBDecks);
if(open_file && deckManager.LoadDeck(open_file_name)) {
if(open_file && deckManager.LoadDeck(open_file_name_with_category)) {
#ifdef WIN32
wchar_t *dash = wcsrchr(open_file_name, L'\\');
#else
......
This diff is collapsed.
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