diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2006-11-05 15:22:13 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2006-11-05 15:22:13 +0000 |
commit | 6374ef220d8f46647190074338f868b5d6bb4a45 (patch) | |
tree | a833453c2e712c3e992f71433f6d21c8c379ad15 /src/gui/shop.cpp | |
parent | de61b658590630cfc59960c012c8e533b361a8b0 (diff) | |
download | mana-6374ef220d8f46647190074338f868b5d6bb4a45.tar.gz mana-6374ef220d8f46647190074338f868b5d6bb4a45.tar.bz2 mana-6374ef220d8f46647190074338f868b5d6bb4a45.tar.xz mana-6374ef220d8f46647190074338f868b5d6bb4a45.zip |
Merged 0.0 changes from revision 2800 to 2825 to trunk.
Diffstat (limited to 'src/gui/shop.cpp')
-rw-r--r-- | src/gui/shop.cpp | 44 |
1 files changed, 42 insertions, 2 deletions
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<ITEM_SHOP>* ShopItems::getShop() +{ + return &mItemsShop; } |