diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-08-25 22:42:24 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-08-25 22:42:24 +0300 |
commit | d004880b9054d61fa0f092ba74553d8062e36b4b (patch) | |
tree | 4f7104e2d9add16bd31169d04ddb584a1bc7e792 /src/gui/widgets/itemcontainer.cpp | |
parent | 7f58784d306fa85bf638c1a172d83bd5a2891132 (diff) | |
download | manaplus-d004880b9054d61fa0f092ba74553d8062e36b4b.tar.gz manaplus-d004880b9054d61fa0f092ba74553d8062e36b4b.tar.bz2 manaplus-d004880b9054d61fa0f092ba74553d8062e36b4b.tar.xz manaplus-d004880b9054d61fa0f092ba74553d8062e36b4b.zip |
In item sorting by name in inventort sort by name with colors.
Diffstat (limited to 'src/gui/widgets/itemcontainer.cpp')
-rw-r--r-- | src/gui/widgets/itemcontainer.cpp | 14 |
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); } |