mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-25 16:46:17 +00:00
Added: Quality range filter to inventory
--HG-- branch : develop
This commit is contained in:
parent
7350291a56
commit
c435f77201
2 changed files with 35 additions and 1 deletions
|
@ -2014,12 +2014,38 @@ bool SBagOptions::parse(xmlNodePtr cur, CInterfaceGroup * /* parentGroup */)
|
|||
// ***************************************************************************
|
||||
void SBagOptions::setSearchFilter(const ucstring &s)
|
||||
{
|
||||
SearchQualityMin = 0;
|
||||
SearchQualityMax = 999;
|
||||
SearchFilter.clear();
|
||||
SearchFilterChanged = true;
|
||||
|
||||
if (!s.empty())
|
||||
{
|
||||
splitUCString(toLower(s), ucstring(" "), SearchFilter);
|
||||
std::vector<ucstring> words;
|
||||
splitUCString(toLower(s), ucstring(" "), words);
|
||||
|
||||
size_t pos;
|
||||
for(int i = 0; i<words.size(); ++i)
|
||||
{
|
||||
std::string kw = words[i].toUtf8();
|
||||
|
||||
pos = kw.find("-");
|
||||
if (pos != std::string::npos)
|
||||
{
|
||||
uint16 first;
|
||||
uint16 last;
|
||||
if (fromString(kw.substr(0, pos), first))
|
||||
SearchQualityMin = first;
|
||||
|
||||
if (fromString(kw.substr(pos+1), last))
|
||||
SearchQualityMax = last;
|
||||
|
||||
if (first == 0 && last == 0)
|
||||
SearchFilter.push_back(words[i]);
|
||||
}
|
||||
else
|
||||
SearchFilter.push_back(words[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2114,6 +2140,10 @@ bool SBagOptions::canDisplay(CDBCtrlSheet *pCS) const
|
|||
}
|
||||
}
|
||||
|
||||
// Quality range
|
||||
if (SearchQualityMin > pCS->getQuality() || SearchQualityMax < pCS->getQuality())
|
||||
return false;
|
||||
|
||||
// Armor
|
||||
if ((pIS->Family == ITEMFAMILY::ARMOR) ||
|
||||
(pIS->Family == ITEMFAMILY::JEWELRY))
|
||||
|
|
|
@ -521,6 +521,8 @@ struct SBagOptions
|
|||
bool LastDbFilterTP;
|
||||
|
||||
bool SearchFilterChanged;
|
||||
uint16 SearchQualityMin;
|
||||
uint16 SearchQualityMax;
|
||||
std::vector<ucstring> SearchFilter;
|
||||
|
||||
// -----------------------
|
||||
|
@ -530,6 +532,8 @@ struct SBagOptions
|
|||
DbFilterArmor = DbFilterWeapon = DbFilterTool = DbFilterMP = DbFilterMissMP = DbFilterTP = NULL;
|
||||
LastDbFilterArmor = LastDbFilterWeapon = LastDbFilterTool = LastDbFilterMP = LastDbFilterMissMP = LastDbFilterTP = false;
|
||||
SearchFilterChanged = false;
|
||||
SearchQualityMin = 0;
|
||||
SearchQualityMax = 999;
|
||||
}
|
||||
|
||||
bool parse (xmlNodePtr cur, CInterfaceGroup *parentGroup);
|
||||
|
|
Loading…
Reference in a new issue