Commit 342b54ea authored by mercury233's avatar mercury233

fix command open deck

parent b290cc5d
...@@ -202,14 +202,24 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -202,14 +202,24 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
mainGame->cbDBDecks->addItem(dname); mainGame->cbDBDecks->addItem(dname);
mainGame->cbDBDecks->setSelected(mainGame->cbDBDecks->getItemCount() - 1); mainGame->cbDBDecks->setSelected(mainGame->cbDBDecks->getItemCount() - 1);
} }
int catesel = mainGame->cbDBCategory->getSelected();
wchar_t catepath[256]; wchar_t catepath[256];
deckManager.GetCategoryPath(catepath, mainGame->cbDBCategory->getSelected(), mainGame->cbDBCategory->getText()); deckManager.GetCategoryPath(catepath, catesel, mainGame->cbDBCategory->getText());
wchar_t filepath[256]; wchar_t filepath[256];
myswprintf(filepath, L"%ls/%ls.ydk", catepath, dname); myswprintf(filepath, L"%ls/%ls.ydk", catepath, dname);
if(deckManager.SaveDeck(deckManager.current_deck, filepath)) { if(deckManager.SaveDeck(deckManager.current_deck, filepath)) {
mainGame->stACMessage->setText(dataManager.GetSysString(1335)); mainGame->stACMessage->setText(dataManager.GetSysString(1335));
mainGame->PopupElement(mainGame->wACMessage, 20); mainGame->PopupElement(mainGame->wACMessage, 20);
is_modified = false; is_modified = false;
if(catesel == -1) {
catesel = 2;
prev_category = catesel;
RefreshReadonly(catesel);
mainGame->cbDBCategory->setSelected(catesel);
mainGame->btnManageDeck->setEnabled(true);
mainGame->cbDBCategory->setEnabled(true);
mainGame->cbDBDecks->setEnabled(true);
}
} }
break; break;
} }
......
...@@ -111,8 +111,8 @@ int main(int argc, char* argv[]) { ...@@ -111,8 +111,8 @@ int main(int argc, char* argv[]) {
keep_on_return = true; keep_on_return = true;
} else if(!wcscmp(wargv[i], L"-d")) { // Deck } else if(!wcscmp(wargv[i], L"-d")) { // Deck
++i; ++i;
ygo::mainGame->gameConf.lastcategory[0] = 0;
if(i + 1 < wargc) { // select deck if(i + 1 < wargc) { // select deck
ygo::mainGame->gameConf.lastcategory[0] = 0;
wcscpy(ygo::mainGame->gameConf.lastdeck, wargv[i]); wcscpy(ygo::mainGame->gameConf.lastdeck, wargv[i]);
continue; continue;
} else { // open deck } else { // open deck
......
...@@ -374,10 +374,15 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -374,10 +374,15 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
wcsncpy(deck_name, dash + 1, dot - dash - 1); wcsncpy(deck_name, dash + 1, dot - dash - 1);
deck_name[dot - dash - 1] = L'\0'; deck_name[dot - dash - 1] = L'\0';
mainGame->ebDeckname->setText(deck_name); mainGame->ebDeckname->setText(deck_name);
mainGame->cbDBCategory->setSelected(-1);
mainGame->cbDBDecks->setSelected(-1); mainGame->cbDBDecks->setSelected(-1);
mainGame->btnManageDeck->setEnabled(false);
mainGame->cbDBCategory->setEnabled(false);
mainGame->cbDBDecks->setEnabled(false);
} else { } else {
for(size_t i = 0; i < mainGame->cbDBDecks->getItemCount(); ++i) { for(size_t i = 0; i < mainGame->cbDBDecks->getItemCount(); ++i) {
if(!wcscmp(mainGame->cbDBDecks->getItem(i), open_file_name)) { if(!wcscmp(mainGame->cbDBDecks->getItem(i), open_file_name)) {
wcscpy(mainGame->gameConf.lastdeck, open_file_name);
mainGame->cbDBDecks->setSelected(i); mainGame->cbDBDecks->setSelected(i);
break; break;
} }
......
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