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