From d004880b9054d61fa0f092ba74553d8062e36b4b Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 25 Aug 2016 22:42:24 +0300 Subject: In item sorting by name in inventort sort by name with colors. --- src/gui/widgets/itemcontainer.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/gui') 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); } -- cgit v1.2.3-70-g09d2