Commit 6700122a authored by mercury233's avatar mercury233 Committed by nanahira

search alias when searching card code (#2124)

* search alias when searching card code

* fix card artworks offset

* fix
parent 1af7ff22
......@@ -774,15 +774,6 @@ void DeckBuilder::StartFilter() {
void DeckBuilder::FilterCards() {
results.clear();
const wchar_t* pstr = mainGame->ebCardName->getText();
int trycode = BufferIO::GetVal(pstr);
if(dataManager.GetData(trycode, 0)) {
auto ptr = dataManager.GetCodePointer(trycode); // verified by GetData()
results.push_back(ptr);
mainGame->scrFilter->setVisible(false);
mainGame->scrFilter->setPos(0);
myswprintf(result_string, L"%d", results.size());
return;
}
unsigned int set_code = 0;
if(pstr[0] == L'@')
set_code = dataManager.GetSetCode(&pstr[1]);
......@@ -870,9 +861,14 @@ void DeckBuilder::FilterCards() {
} else if(pstr[0] == L'@' && set_code) {
if(!check_set_code(data, set_code)) continue;
} else {
if(!CardNameContains(text.name.c_str(), pstr) && text.text.find(pstr) == std::wstring::npos
int trycode = BufferIO::GetVal(pstr);
bool tryresult = dataManager.GetData(trycode, 0);
if(!tryresult && !CardNameContains(text.name.c_str(), pstr) && text.text.find(pstr) == std::wstring::npos
&& (!set_code || !check_set_code(data, set_code)))
continue;
if (tryresult && data.code != trycode
&& !(data.alias == trycode && (data.alias - data.code < CARD_ARTWORK_VERSIONS_OFFSET || data.code - data.alias < CARD_ARTWORK_VERSIONS_OFFSET)))
continue;
}
}
results.push_back(ptr);
......
......@@ -1215,7 +1215,7 @@ void Game::ShowCardInfo(int code) {
memset(&cd, 0, sizeof(CardData));
imgCard->setImage(imageManager.GetTexture(code));
imgCard->setScaleImage(true);
if(cd.alias != 0 && (cd.alias - code < 10 || code - cd.alias < 10))
if(cd.alias != 0 && (cd.alias - code < CARD_ARTWORK_VERSIONS_OFFSET || code - cd.alias < CARD_ARTWORK_VERSIONS_OFFSET))
myswprintf(formatBuffer, L"%ls[%08d]", dataManager.GetName(cd.alias), cd.alias);
else myswprintf(formatBuffer, L"%ls[%08d]", dataManager.GetName(code), code);
stName->setText(formatBuffer);
......
......@@ -625,4 +625,6 @@ extern Game* mainGame;
#define BUTTON_MARKERS_OK 381
#define DEFAULT_DUEL_RULE 4
#define CARD_ARTWORK_VERSIONS_OFFSET 10
#endif // GAME_H
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