summaryrefslogtreecommitdiff
path: root/src/gui/shop.cpp
diff options
context:
space:
mode:
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();
}