Commit 3369ec05 authored by mercury233's avatar mercury233 Committed by GitHub

update card search trycode (#2589)

parent a8ccdbb1
...@@ -1348,6 +1348,7 @@ void DeckBuilder::FilterCards() { ...@@ -1348,6 +1348,7 @@ void DeckBuilder::FilterCards() {
element_t(): type(type_t::all), exclude(false) {} element_t(): type(type_t::all), exclude(false) {}
}; };
const wchar_t* pstr = mainGame->ebCardName->getText(); const wchar_t* pstr = mainGame->ebCardName->getText();
int trycode = BufferIO::GetVal(pstr);
std::wstring str = std::wstring(pstr); std::wstring str = std::wstring(pstr);
std::vector<element_t> query_elements; std::vector<element_t> query_elements;
if(mainGame->gameConf.search_multiple_keywords) { if(mainGame->gameConf.search_multiple_keywords) {
...@@ -1492,16 +1493,12 @@ void DeckBuilder::FilterCards() { ...@@ -1492,16 +1493,12 @@ void DeckBuilder::FilterCards() {
match = CardNameContains(text.name.c_str(), elements_iterator->keyword.c_str()); match = CardNameContains(text.name.c_str(), elements_iterator->keyword.c_str());
} else if (elements_iterator->type == element_t::type_t::setcode) { } else if (elements_iterator->type == element_t::type_t::setcode) {
match = data.is_setcodes(elements_iterator->setcodes); match = data.is_setcodes(elements_iterator->setcodes);
} else if (trycode && (data.code == trycode || data.alias == trycode && data.is_alternative())){
match = true;
} else { } else {
int trycode = BufferIO::GetVal(elements_iterator->keyword.c_str());
bool tryresult = dataManager.GetData(trycode, 0);
if(!tryresult) {
match = CardNameContains(text.name.c_str(), elements_iterator->keyword.c_str()) match = CardNameContains(text.name.c_str(), elements_iterator->keyword.c_str())
|| text.text.find(elements_iterator->keyword) != std::wstring::npos || text.text.find(elements_iterator->keyword) != std::wstring::npos
|| data.is_setcodes(elements_iterator->setcodes); || data.is_setcodes(elements_iterator->setcodes);
} else {
match = data.code == trycode || data.alias == trycode;
}
} }
if(elements_iterator->exclude) if(elements_iterator->exclude)
match = !match; match = !match;
......
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