summaryrefslogtreecommitdiff
path: root/src/gui/widgets/itemcontainer.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-09-09 00:47:31 +0300
committerAndrei Karas <akaras@inbox.ru>2011-09-09 00:47:57 +0300
commite72f26151bca6c5a73d0377e385c0f7dd7cab3aa (patch)
tree6960f1846e0258a5f3658cae6e2f40f643074e3f /src/gui/widgets/itemcontainer.cpp
parentf1c17766c66394ce875854430f8f028c0fa5b3a5 (diff)
downloadmanaplus-e72f26151bca6c5a73d0377e385c0f7dd7cab3aa.tar.gz
manaplus-e72f26151bca6c5a73d0377e385c0f7dd7cab3aa.tar.bz2
manaplus-e72f26151bca6c5a73d0377e385c0f7dd7cab3aa.tar.xz
manaplus-e72f26151bca6c5a73d0377e385c0f7dd7cab3aa.zip
Add to inventory filter by letters from item names.
Diffstat (limited to 'src/gui/widgets/itemcontainer.cpp')
-rw-r--r--src/gui/widgets/itemcontainer.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 75968d668..84313d64f 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -513,6 +513,9 @@ void ItemContainer::updateMatrix()
int i = 0;
int j = 0;
+ std::string temp = mName;
+ toLower(temp);
+
for (unsigned idx = 0; idx < mInventory->getSize(); idx ++)
{
Item *item = mInventory->getItem(idx);
@@ -520,7 +523,15 @@ void ItemContainer::updateMatrix()
if (!item || item->getId() == 0 || !item->isHaveTag(mTag))
continue;
- sortedItems.push_back(new ItemIdPair(idx, item));
+ if (mName.empty())
+ {
+ sortedItems.push_back(new ItemIdPair(idx, item));
+ continue;
+ }
+ std::string name = item->getInfo().getName();
+ toLower(name);
+ if (name.find(temp) != std::string::npos)
+ sortedItems.push_back(new ItemIdPair(idx, item));
}
switch (mSortType)