summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-05-16 12:51:22 +0300
committerAndrei Karas <akaras@inbox.ru>2014-05-16 12:51:22 +0300
commitce699929e853c21d4cbd4e5a84ed76ca904f5bab (patch)
tree09e9a5525ee156bf02bbb46787afaa589bd530e5
parent27ac526d33ed1c1419cea59b9ad2d320c3a8f68d (diff)
downloadmv-ce699929e853c21d4cbd4e5a84ed76ca904f5bab.tar.gz
mv-ce699929e853c21d4cbd4e5a84ed76ca904f5bab.tar.bz2
mv-ce699929e853c21d4cbd4e5a84ed76ca904f5bab.tar.xz
mv-ce699929e853c21d4cbd4e5a84ed76ca904f5bab.zip
Add anonimous namespace into buydialog.
-rw-r--r--src/gui/windows/buydialog.cpp193
1 files changed, 98 insertions, 95 deletions
diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp
index a672ba338..f0daaeef2 100644
--- a/src/gui/windows/buydialog.cpp
+++ b/src/gui/windows/buydialog.cpp
@@ -56,107 +56,110 @@
#include "debug.h"
-class SortItemPriceFunctor final
+namespace
{
- public:
- bool operator() (const ShopItem *const item1,
- const ShopItem *const item2) const
- {
- if (!item1 || !item2)
- return false;
-
- const int price1 = item1->getPrice();
- const int price2 = item2->getPrice();
- if (price1 == price2)
- return item1->getDisplayName() < item2->getDisplayName();
- return price1 < price2;
- }
-} itemPriceBuySorter;
+ class SortItemPriceFunctor final
+ {
+ public:
+ bool operator() (const ShopItem *const item1,
+ const ShopItem *const item2) const
+ {
+ if (!item1 || !item2)
+ return false;
+
+ const int price1 = item1->getPrice();
+ const int price2 = item2->getPrice();
+ if (price1 == price2)
+ return item1->getDisplayName() < item2->getDisplayName();
+ return price1 < price2;
+ }
+ } itemPriceBuySorter;
-class SortItemNameFunctor final
-{
- public:
- bool operator() (const ShopItem *const item1,
- const ShopItem *const item2) const
- {
- if (!item1 || !item2)
- return false;
-
- const std::string &name1 = item1->getDisplayName();
- const std::string &name2 = item2->getDisplayName();
- if (name1 == name2)
- return item1->getPrice() < item2->getPrice();
- return name1 < name2;
- }
-} itemNameBuySorter;
+ class SortItemNameFunctor final
+ {
+ public:
+ bool operator() (const ShopItem *const item1,
+ const ShopItem *const item2) const
+ {
+ if (!item1 || !item2)
+ return false;
+
+ const std::string &name1 = item1->getDisplayName();
+ const std::string &name2 = item2->getDisplayName();
+ if (name1 == name2)
+ return item1->getPrice() < item2->getPrice();
+ return name1 < name2;
+ }
+ } itemNameBuySorter;
-class SortItemIdFunctor final
-{
- public:
- bool operator() (const ShopItem *const item1,
- const ShopItem *const item2) const
- {
- if (!item1 || !item2)
- return false;
-
- const int id1 = item1->getId();
- const int id2 = item2->getId();
- if (id1 == id2)
- return item1->getPrice() < item2->getPrice();
- return id1 < id2;
- }
-} itemIdBuySorter;
+ class SortItemIdFunctor final
+ {
+ public:
+ bool operator() (const ShopItem *const item1,
+ const ShopItem *const item2) const
+ {
+ if (!item1 || !item2)
+ return false;
+
+ const int id1 = item1->getId();
+ const int id2 = item2->getId();
+ if (id1 == id2)
+ return item1->getPrice() < item2->getPrice();
+ return id1 < id2;
+ }
+ } itemIdBuySorter;
-class SortItemWeightFunctor final
-{
- public:
- bool operator() (const ShopItem *const item1,
- const ShopItem *const item2) const
- {
- if (!item1 || !item2)
- return false;
-
- const int weight1 = item1->getInfo().getWeight();
- const int weight2 = item2->getInfo().getWeight();
- if (weight1 == weight2)
- return item1->getPrice() < item2->getPrice();
- return weight1 < weight2;
- }
-} itemWeightBuySorter;
+ class SortItemWeightFunctor final
+ {
+ public:
+ bool operator() (const ShopItem *const item1,
+ const ShopItem *const item2) const
+ {
+ if (!item1 || !item2)
+ return false;
+
+ const int weight1 = item1->getInfo().getWeight();
+ const int weight2 = item2->getInfo().getWeight();
+ if (weight1 == weight2)
+ return item1->getPrice() < item2->getPrice();
+ return weight1 < weight2;
+ }
+ } itemWeightBuySorter;
-class SortItemAmountFunctor final
-{
- public:
- bool operator() (const ShopItem *const item1,
- const ShopItem *const item2) const
- {
- if (!item1 || !item2)
- return false;
-
- const int amount1 = item1->getQuantity();
- const int amount2 = item2->getQuantity();
- if (amount1 == amount2)
- return item1->getPrice() < item2->getPrice();
- return amount1 < amount2;
- }
-} itemAmountBuySorter;
+ class SortItemAmountFunctor final
+ {
+ public:
+ bool operator() (const ShopItem *const item1,
+ const ShopItem *const item2) const
+ {
+ if (!item1 || !item2)
+ return false;
+
+ const int amount1 = item1->getQuantity();
+ const int amount2 = item2->getQuantity();
+ if (amount1 == amount2)
+ return item1->getPrice() < item2->getPrice();
+ return amount1 < amount2;
+ }
+ } itemAmountBuySorter;
-class SortItemTypeFunctor final
-{
- public:
- bool operator() (const ShopItem *const item1,
- const ShopItem *const item2) const
- {
- if (!item1 || !item2)
- return false;
-
- const ItemType type1 = item1->getInfo().getType();
- const ItemType type2 = item2->getInfo().getType();
- if (type1 == type2)
- return item1->getPrice() < item2->getPrice();
- return type1 < type2;
- }
-} itemTypeBuySorter;
+ class SortItemTypeFunctor final
+ {
+ public:
+ bool operator() (const ShopItem *const item1,
+ const ShopItem *const item2) const
+ {
+ if (!item1 || !item2)
+ return false;
+
+ const ItemType type1 = item1->getInfo().getType();
+ const ItemType type2 = item2->getInfo().getType();
+ if (type1 == type2)
+ return item1->getPrice() < item2->getPrice();
+ return type1 < type2;
+ }
+ } itemTypeBuySorter;
+}
BuyDialog::DialogList BuyDialog::instances;