mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-18 17:35:43 +00:00
CResourceProxyModel: Simplify exit cases in filterAcceptsRow()
This commit is contained in:
@@ -61,46 +61,45 @@ bool CResourceProxyModel::filterAcceptsRow(int SourceRow, const QModelIndex& rkS
|
|||||||
if (pEntry && !IsTypeAccepted(pEntry->TypeInfo()))
|
if (pEntry && !IsTypeAccepted(pEntry->TypeInfo()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (mSearchString.IsEmpty())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (!pEntry)
|
||||||
|
return false;
|
||||||
|
|
||||||
// Compare search results
|
// Compare search results
|
||||||
if (!mSearchString.IsEmpty())
|
const bool HasNameMatch = pEntry->UppercaseName().Contains(mSearchString);
|
||||||
|
if (HasNameMatch)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
bool HasIDMatch = false;
|
||||||
|
|
||||||
|
if (mCompareBitLength > 0)
|
||||||
{
|
{
|
||||||
if (!pEntry)
|
const auto IDBitLength = static_cast<uint32_t>(pEntry->ID().Length()) * 8;
|
||||||
return false;
|
|
||||||
|
|
||||||
const bool HasNameMatch = pEntry->UppercaseName().Contains(mSearchString);
|
if (mCompareBitLength <= IDBitLength)
|
||||||
|
|
||||||
if (!HasNameMatch)
|
|
||||||
{
|
{
|
||||||
bool HasIDMatch = false;
|
const uint64_t ID = pEntry->ID().ToLongLong();
|
||||||
|
const uint32_t MaxShift = IDBitLength - mCompareBitLength;
|
||||||
|
|
||||||
if (mCompareBitLength > 0)
|
for (uint32_t Shift = 0; Shift <= MaxShift; Shift += 4)
|
||||||
{
|
{
|
||||||
const auto IDBitLength = static_cast<uint32_t>(pEntry->ID().Length()) * 8;
|
const uint64_t ShiftCompare = mCompareID << Shift;
|
||||||
|
const uint64_t Mask = mCompareMask << Shift;
|
||||||
|
|
||||||
if (mCompareBitLength <= IDBitLength)
|
if ((ID & Mask) == ShiftCompare)
|
||||||
{
|
{
|
||||||
const uint64_t ID = pEntry->ID().ToLongLong();
|
HasIDMatch = true;
|
||||||
const uint32_t MaxShift = IDBitLength - mCompareBitLength;
|
break;
|
||||||
|
|
||||||
for (uint32_t Shift = 0; Shift <= MaxShift; Shift += 4)
|
|
||||||
{
|
|
||||||
const uint64_t ShiftCompare = mCompareID << Shift;
|
|
||||||
const uint64_t Mask = mCompareMask << Shift;
|
|
||||||
|
|
||||||
if ((ID & Mask) == ShiftCompare)
|
|
||||||
{
|
|
||||||
HasIDMatch = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!HasIDMatch)
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!HasIDMatch)
|
||||||
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user