-
Notifications
You must be signed in to change notification settings - Fork 645
Move default_index to DeckBuilder #3126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
23c5091
62cb1c1
93bbca3
362678a
0d89a07
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1951,10 +1951,18 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) { | |
| break; | ||
| } | ||
| case CHECKBOX_LFLIST: { | ||
| mainGame->gameConf.use_lflist = mainGame->chkLFlist->isChecked() ? 1 : 0; | ||
| mainGame->cbLFlist->setEnabled(mainGame->gameConf.use_lflist); | ||
| mainGame->cbLFlist->setSelected(mainGame->gameConf.use_lflist ? mainGame->gameConf.default_lflist : mainGame->cbLFlist->getItemCount() - 1); | ||
| mainGame->cbHostLFlist->setSelected(mainGame->gameConf.use_lflist ? mainGame->gameConf.default_lflist : mainGame->cbHostLFlist->getItemCount() - 1); | ||
| if (mainGame->chkLFlist->isChecked()) { | ||
| mainGame->gameConf.use_lflist = 1; | ||
| mainGame->cbLFlist->setEnabled(true); | ||
| mainGame->cbLFlist->setSelected(mainGame->deckBuilder.default_index); | ||
| mainGame->cbHostLFlist->setSelected(mainGame->deckBuilder.default_index); | ||
| } | ||
| else { | ||
| mainGame->gameConf.use_lflist = 0; | ||
| mainGame->cbLFlist->setEnabled(false); | ||
| mainGame->cbLFlist->setSelected(mainGame->cbLFlist->getItemCount() - 1); | ||
| mainGame->cbHostLFlist->setSelected(mainGame->cbHostLFlist->getItemCount() - 1); | ||
| } | ||
| mainGame->deckBuilder.filterList = &deckManager._lfList[mainGame->cbLFlist->getSelected()]; | ||
| return true; | ||
| break; | ||
|
|
@@ -1965,9 +1973,12 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) { | |
| case irr::gui::EGET_COMBO_BOX_CHANGED: { | ||
| switch(id) { | ||
| case COMBOBOX_LFLIST: { | ||
| mainGame->gameConf.default_lflist = mainGame->cbLFlist->getSelected(); | ||
| mainGame->cbHostLFlist->setSelected(mainGame->gameConf.default_lflist); | ||
| mainGame->deckBuilder.filterList = &deckManager._lfList[mainGame->gameConf.default_lflist]; | ||
| int sel = mainGame->cbLFlist->getSelected(); | ||
| if (sel != -1) { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently not necessary. One empty lflist is always be pushed to
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Writing -1 to index is not acceptable. I suppose that checking selected value of any combobox is a good practice.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In practice, only the deck list combo box can be empty. The other combo boxes should never be empty in theory, so it's fine to use them directly. |
||
| mainGame->deckBuilder.default_index = mainGame->cbLFlist->getSelected(); | ||
| mainGame->cbHostLFlist->setSelected(sel); | ||
| mainGame->deckBuilder.filterList = &deckManager._lfList[mainGame->deckBuilder.default_index]; | ||
| } | ||
| return true; | ||
| break; | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.