diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-09-09 00:47:31 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-09-09 00:47:57 +0300 |
commit | e72f26151bca6c5a73d0377e385c0f7dd7cab3aa (patch) | |
tree | 6960f1846e0258a5f3658cae6e2f40f643074e3f /src/gui/widgets/itemcontainer.cpp | |
parent | f1c17766c66394ce875854430f8f028c0fa5b3a5 (diff) | |
download | manaplus-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.cpp | 13 |
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) |