diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-05-03 20:09:53 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-05-03 20:09:53 +0300 |
commit | 602fd127d09c995bc5470218c862b2cebfc558d5 (patch) | |
tree | 6937760eb81a234c2aaf9c7494f6bce02176a2f5 /src/gui/models/shopitems.cpp | |
parent | fef6ebca9c454f99d44e950c4628270b124c445f (diff) | |
download | plus-602fd127d09c995bc5470218c862b2cebfc558d5.tar.gz plus-602fd127d09c995bc5470218c862b2cebfc558d5.tar.bz2 plus-602fd127d09c995bc5470218c862b2cebfc558d5.tar.xz plus-602fd127d09c995bc5470218c862b2cebfc558d5.zip |
Add filter into buy dialogs.
Diffstat (limited to 'src/gui/models/shopitems.cpp')
-rw-r--r-- | src/gui/models/shopitems.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/gui/models/shopitems.cpp b/src/gui/models/shopitems.cpp index 1a9b89994..2fd399cb0 100644 --- a/src/gui/models/shopitems.cpp +++ b/src/gui/models/shopitems.cpp @@ -29,6 +29,7 @@ #include "debug.h" ShopItems::ShopItems(const bool mergeDuplicates) : + mAllShopItems(), mShopItems(), mMergeDuplicates(mergeDuplicates) { @@ -58,6 +59,7 @@ ShopItem *ShopItems::addItem(const int id, { ShopItem *const item = new ShopItem(-1, id, type, color, amount, price); mShopItems.push_back(item); + mAllShopItems.push_back(item); return item; } @@ -72,6 +74,7 @@ ShopItem *ShopItems::addItemNoDup(const int id, { item = new ShopItem(-1, id, type, color, amount, price); mShopItems.push_back(item); + mAllShopItems.push_back(item); } return item; } @@ -95,6 +98,7 @@ ShopItem *ShopItems::addItem2(const int inventoryIndex, { item = new ShopItem(inventoryIndex, id, type, color, quantity, price); mShopItems.push_back(item); + mAllShopItems.push_back(item); } return item; } @@ -127,7 +131,8 @@ void ShopItems::del(const unsigned int i) void ShopItems::clear() { - delete_all(mShopItems); + delete_all(mAllShopItems); + mAllShopItems.clear(); mShopItems.clear(); } @@ -146,3 +151,14 @@ ShopItem *ShopItems::findItem(const int id, const unsigned char color) const return nullptr; } + +void ShopItems::updateList() +{ + mShopItems.clear(); + FOR_EACH (std::vector<ShopItem*>::iterator, it, mAllShopItems) + { + ShopItem *const item = *it; + if (item && item->isVisible()) + mShopItems.push_back(item); + } +} |