summaryrefslogtreecommitdiff
path: root/src/gui/shop.cpp
diff options
context:
space:
mode:
authorYohann Ferreira <bertram@cegetel.net>2006-11-05 00:28:55 +0000
committerYohann Ferreira <bertram@cegetel.net>2006-11-05 00:28:55 +0000
commit502af71c74d0b1d5b123d424bc023fcce49916ec (patch)
tree43e6ec1fb1ab283b8cdd7f1c394bcfb7939c1861 /src/gui/shop.cpp
parent0c85783de45e334f9e116360fec0ae19dccab085 (diff)
downloadMana-502af71c74d0b1d5b123d424bc023fcce49916ec.tar.gz
Mana-502af71c74d0b1d5b123d424bc023fcce49916ec.tar.bz2
Mana-502af71c74d0b1d5b123d424bc023fcce49916ec.tar.xz
Mana-502af71c74d0b1d5b123d424bc023fcce49916ec.zip
Added pictures to items in buy dialogs. Also too expensive items are highlighted in gray and can't be selected.
Diffstat (limited to 'src/gui/shop.cpp')
-rw-r--r--src/gui/shop.cpp39
1 files changed, 37 insertions, 2 deletions
diff --git a/src/gui/shop.cpp b/src/gui/shop.cpp
index 3706cdf8..39c285d7 100644
--- a/src/gui/shop.cpp
+++ b/src/gui/shop.cpp
@@ -22,13 +22,48 @@
*/
#include "shop.h"
+#include "../utils/tostring.h"
+#include "../resources/itemmanager.h"
+
+ShopItems::~ShopItems()
+{
+ clear();
+}
int ShopItems::getNumberOfElements()
{
- return size();
+ return mItemsShop.size();
}
std::string ShopItems::getElementAt(int i)
{
- return at(i).name;
+ return mItemsShop.at(i).name;
+}
+
+void ShopItems::addItem(short id, int price)
+{
+ ITEM_SHOP item_shop;
+
+ item_shop.name = itemDb->getItemInfo(id).getName()
+ + " " + toString(price) + " GP";
+ item_shop.price = price;
+ item_shop.id = id;
+ item_shop.image = itemDb->getItemInfo(id).getImage();
+
+ mItemsShop.push_back(item_shop);
+}
+
+ITEM_SHOP ShopItems::at(int i)
+{
+ return mItemsShop.at(i);
+}
+
+void ShopItems::push_back(ITEM_SHOP item_shop)
+{
+ mItemsShop.push_back(item_shop);
+}
+
+void ShopItems::clear()
+{
+ mItemsShop.clear();
}