Commit 5a9b97b1 authored by edo9300's avatar edo9300 Committed by GitHub

Format and update CardNameCompare

parent 3964308f
...@@ -880,53 +880,38 @@ void DeckBuilder::FilterCards() { ...@@ -880,53 +880,38 @@ void DeckBuilder::FilterCards() {
} }
SortList(); SortList();
} }
bool DeckBuilder::CardNameCompare(const wchar_t *sa, const wchar_t *sb) bool DeckBuilder::CardNameCompare(const wchar_t *sa, const wchar_t *sb) {
{ if(!sa || !sb || (wcslen(sb) > wcslen(sa)))
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; return false;
while (sa[i]) int i = 0, j = 0, k;
{ wchar_t ca, cb, pwc, wc = L'*';
bool wcr = false;
while(sa[i]) {
ca = towupper(sa[i]); ca = towupper(sa[i]);
cb = towupper(sb[j]); cb = towupper(sb[j]);
if (ca == cb) if(ca == cb) {
{
j++; j++;
if (!sb[j]) if(!sb[j])
return true; return true;
} } else if(cb == wc) {
else if (cb == wc) while(sb[j] == wc) {
{
while (sb[j] == wc)
{
j++; j++;
if (!sb[j]) if(!sb[j])
return true; return true;
} }
k = j; k = j;
pwc = towupper(sb[j]); pwc = towupper(sb[j]);
wcr = true; wcr = true;
while (towupper(sa[i]) != pwc) { while(towupper(sa[i]) != pwc) {
i++; i++;
if (!sa[i]) if(!sa[i])
return false; return false;
} }
i--; i--;
} } else if(wcr && ca == pwc) {
else if (wcr && ca == pwc)
{
j = k; j = k;
i--; i--;
} } else
else
j = 0; j = 0;
i++; 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