summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-08-25 22:42:24 +0300
committerAndrei Karas <akaras@inbox.ru>2016-08-25 22:42:24 +0300
commitd004880b9054d61fa0f092ba74553d8062e36b4b (patch)
tree4f7104e2d9add16bd31169d04ddb584a1bc7e792
parent7f58784d306fa85bf638c1a172d83bd5a2891132 (diff)
downloadmv-d004880b9054d61fa0f092ba74553d8062e36b4b.tar.gz
mv-d004880b9054d61fa0f092ba74553d8062e36b4b.tar.bz2
mv-d004880b9054d61fa0f092ba74553d8062e36b4b.tar.xz
mv-d004880b9054d61fa0f092ba74553d8062e36b4b.zip
In item sorting by name in inventort sort by name with colors.
-rw-r--r--src/gui/widgets/itemcontainer.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 26630afad..ea01bcd5d 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -81,15 +81,19 @@ namespace
bool operator() (const ItemIdPair *const pair1,
const ItemIdPair *const pair2) const
{
- if (!pair1->mItem || !pair2->mItem)
+ const Item *const item1 = pair1->mItem;
+ const Item *const item2 = pair2->mItem;
+ if (!item1 || !item2)
return false;
- const std::string name1 = pair1->mItem->getInfo().getName();
- const std::string name2 = pair2->mItem->getInfo().getName();
+ const std::string name1 = item1->getInfo().getName(
+ item1->getColor());
+ const std::string name2 = item2->getInfo().getName(
+ item2->getColor());
if (name1 == name2)
{
- return pair1->mItem->getInvIndex() <
- pair2->mItem->getInvIndex();
+ return item1->getInvIndex() <
+ item2->getInvIndex();
}
return (name1 < name2);
}