Commit 97a3b04c authored by mercury233's avatar mercury233

add auto_search_limit

parent 317ce145
......@@ -281,9 +281,10 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break;
}
case irr::gui::EGET_EDITBOX_CHANGED: {
switch (id) {
switch(id) {
case EDITBOX_KEYWORD: {
StartFilter();
if(mainGame->gameConf.auto_search_limit >= 0 && (wcslen(mainGame->ebCardName->getText()) >= mainGame->gameConf.auto_search_limit))
StartFilter();
break;
}
}
......
......@@ -902,6 +902,7 @@ void Game::LoadConfig() {
gameConf.control_mode = 0;
gameConf.draw_field_spell = 1;
gameConf.separate_clear_button = 1;
gameConf.auto_search_limit = -1;
fseek(fp, 0, SEEK_END);
int fsize = ftell(fp);
fseek(fp, 0, SEEK_SET);
......@@ -956,6 +957,8 @@ void Game::LoadConfig() {
gameConf.draw_field_spell = atoi(valbuf);
} else if(!strcmp(strbuf, "separate_clear_button")) {
gameConf.separate_clear_button = atoi(valbuf);
} else if(!strcmp(strbuf, "auto_search_limit")) {
gameConf.auto_search_limit = atoi(valbuf);
} else {
// options allowing multiple words
sscanf(linebuf, "%s = %240[^\n]", strbuf, valbuf);
......@@ -1009,6 +1012,8 @@ void Game::SaveConfig() {
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);
fprintf(fp, "#auto_search_limit >= 0: Start search automatically when the user enters N chars\n");
fprintf(fp, "auto_search_limit = %d\n", gameConf.auto_search_limit);
fclose(fp);
}
void Game::ShowCardInfo(int code) {
......
......@@ -36,6 +36,7 @@ struct Config {
int control_mode;
int draw_field_spell;
int separate_clear_button;
int auto_search_limit;
};
struct DuelInfo {
......
......@@ -23,3 +23,5 @@ hide_hint_button = 1
control_mode = 0
draw_field_spell = 1
separate_clear_button = 1
#auto_search_limit >= 0: Start search automatically when the user enters N chars.
auto_search_limit = -1
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