Commit d52d9691 authored by VanillaSalt's avatar VanillaSalt

clear filter button

parent 024b36f0
......@@ -119,17 +119,21 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
filter_type = mainGame->cbCardType->getSelected();
filter_type2 = mainGame->cbCardType2->getItemData(mainGame->cbCardType2->getSelected());
filter_lm = mainGame->cbLimit->getSelected();
if(filter_type > 1) {
FilterCards();
break;
}
if(filter_type == 1) {
filter_attrib = mainGame->cbAttribute->getItemData(mainGame->cbAttribute->getSelected());
filter_race = mainGame->cbRace->getItemData(mainGame->cbRace->getSelected());
filter_atk = parse_filter(mainGame->ebAttack->getText(), &filter_atktype);
filter_def = parse_filter(mainGame->ebDefence->getText(), &filter_deftype);
filter_lv = parse_filter(mainGame->ebStar->getText(), &filter_lvtype);
filter_scl = parse_filter(mainGame->ebScale->getText(), &filter_scltype);
}
FilterCards();
if(!mainGame->gameConf.separate_clear_button)
ClearFilter();
break;
}
case BUTTON_CLEAR_FILTER: {
ClearFilter();
break;
}
case BUTTON_CATEGORY_OK: {
......@@ -717,6 +721,8 @@ void DeckBuilder::FilterCards() {
mainGame->scrFilter->setPos(0);
}
std::sort(results.begin(), results.end(), ClientCard::deck_sort_lv);
}
void DeckBuilder::ClearFilter() {
mainGame->cbAttribute->setSelected(0);
mainGame->cbRace->setSelected(0);
mainGame->cbLimit->setSelected(0);
......
......@@ -12,6 +12,7 @@ class DeckBuilder: public irr::IEventReceiver {
public:
virtual bool OnEvent(const irr::SEvent& event);
void FilterCards();
void ClearFilter();
long long filter_effect;
unsigned int filter_type;
......
......@@ -443,6 +443,10 @@ bool Game::Initialize() {
ebCardName->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
btnEffectFilter = env->addButton(rect<s32>(345, 28, 390, 69), wFilter, BUTTON_EFFECT_FILTER, dataManager.GetSysString(1326));
btnStartFilter = env->addButton(rect<s32>(210, 96, 390, 118), wFilter, BUTTON_START_FILTER, dataManager.GetSysString(1327));
if(mainGame->gameConf.separate_clear_button) {
btnStartFilter->setRelativePosition(rect<s32>(210, 96, 335, 118));
btnClearFilter = env->addButton(rect<s32>(340, 96, 390, 118), wFilter, BUTTON_CLEAR_FILTER, dataManager.GetSysString(1304));
}
wCategories = env->addWindow(rect<s32>(630, 60, 1000, 270), false, dataManager.strBuffer);
wCategories->getCloseButton()->setVisible(false);
wCategories->setDrawTitlebar(false);
......@@ -824,6 +828,7 @@ void Game::LoadConfig() {
gameConf.chkHideSetname = 0;
gameConf.control_mode = 0;
gameConf.draw_field_spell = 1;
gameConf.separate_clear_button = 1;
fseek(fp, 0, SEEK_END);
int fsize = ftell(fp);
fseek(fp, 0, SEEK_SET);
......@@ -874,6 +879,8 @@ void Game::LoadConfig() {
gameConf.control_mode = atoi(valbuf);
} else if(!strcmp(strbuf, "draw_field_spell")) {
gameConf.draw_field_spell = atoi(valbuf);
} else if(!strcmp(strbuf, "separate_clear_button")) {
gameConf.separate_clear_button = atoi(valbuf);
} else {
// options allowing multiple words
sscanf(linebuf, "%s = %240[^\n]", strbuf, valbuf);
......@@ -925,6 +932,7 @@ void Game::SaveConfig() {
fprintf(fp, "#control_mode = 0: Key A/S/R. control_mode = 1: MouseLeft/MouseRight/F9\n");
fprintf(fp, "control_mode = %d\n", gameConf.control_mode);
fprintf(fp, "draw_field_spell = %d\n", gameConf.draw_field_spell);
fprintf(fp, "separate_clear_button = %d\n", gameConf.separate_clear_button);
fclose(fp);
}
void Game::ShowCardInfo(int code) {
......
......@@ -34,6 +34,7 @@ struct Config {
int chkHideSetname;
int control_mode;
int draw_field_spell;
int separate_clear_button;
};
struct DuelInfo {
......@@ -364,6 +365,7 @@ public:
irr::gui::IGUIEditBox* ebCardName;
irr::gui::IGUIButton* btnEffectFilter;
irr::gui::IGUIButton* btnStartFilter;
irr::gui::IGUIButton* btnClearFilter;
irr::gui::IGUIWindow* wCategories;
irr::gui::IGUICheckBox* chkCategory[32];
irr::gui::IGUIButton* btnCategoryOK;
......@@ -489,6 +491,7 @@ extern Game* mainGame;
#define BUTTON_START_FILTER 312
#define SCROLL_FILTER 314
#define EDITBOX_KEYWORD 315
#define BUTTON_CLEAR_FILTER 316
#define BUTTON_REPLAY_START 320
#define BUTTON_REPLAY_PAUSE 321
#define BUTTON_REPLAY_STEP 322
......
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