Commit 3964308f authored by AlphaKretin's avatar AlphaKretin Committed by edo9300

Add wildcard support in deck edit (#6)

* Add wildcard support in deck edit

If a search term contains `*`, the game will return results for which any text is in place of `*`.

* Improve wildcard declaration

ficks

* Improve wildcard handling

Can now detect multiple instances of character immediately after wildcard.

For example, Dinomist Plesios has "Dinomist" in both its Pendulum Effect and Monster effect. Before, if you searched text that matched before `"*` in the Pendulum text, and after `*"` in the monster text, it would terminate on the `"` in the Pendulum text and not match, but now it keeps trying when it finds `"` again in the monster text and successfully matches.
parent dc56edf6
......@@ -884,8 +884,12 @@ bool DeckBuilder::CardNameCompare(const wchar_t *sa, const wchar_t *sb)
{
int i = 0;
int j = 0;
int k;
wchar_t ca;
wchar_t cb;
wchar_t wc = L'*';
wchar_t pwc;
bool wcr = false;
if (!sa || !sb)
return false;
......@@ -899,6 +903,29 @@ bool DeckBuilder::CardNameCompare(const wchar_t *sa, const wchar_t *sb)
if (!sb[j])
return true;
}
else if (cb == wc)
{
while (sb[j] == wc)
{
j++;
if (!sb[j])
return true;
}
k = j;
pwc = towupper(sb[j]);
wcr = true;
while (towupper(sa[i]) != pwc) {
i++;
if (!sa[i])
return false;
}
i--;
}
else if (wcr && ca == pwc)
{
j = k;
i--;
}
else
j = 0;
i++;
......
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