From 6374ef220d8f46647190074338f868b5d6bb4a45 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Sun, 5 Nov 2006 15:22:13 +0000 Subject: Merged 0.0 changes from revision 2800 to 2825 to trunk. --- src/gui/shop.cpp | 44 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) (limited to 'src/gui/shop.cpp') diff --git a/src/gui/shop.cpp b/src/gui/shop.cpp index 3706cdf8..3f30732a 100644 --- a/src/gui/shop.cpp +++ b/src/gui/shop.cpp @@ -22,13 +22,53 @@ */ #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(); +} + +std::vector* ShopItems::getShop() +{ + return &mItemsShop; } -- cgit v1.2.3-70-g09d2