diff options
author | Björn Steinbrink <B.Steinbrink@gmx.de> | 2006-01-31 03:07:31 +0000 |
---|---|---|
committer | Björn Steinbrink <B.Steinbrink@gmx.de> | 2006-01-31 03:07:31 +0000 |
commit | efbf5fa72206086a7563ccfeddd601d324c7912f (patch) | |
tree | 20372135ab3fedd7db0a2370bcf985df7608f838 /src | |
parent | 2fb12d513bb7e10375893e1ae22da3538b20fa27 (diff) | |
download | mana-efbf5fa72206086a7563ccfeddd601d324c7912f.tar.gz mana-efbf5fa72206086a7563ccfeddd601d324c7912f.tar.bz2 mana-efbf5fa72206086a7563ccfeddd601d324c7912f.tar.xz mana-efbf5fa72206086a7563ccfeddd601d324c7912f.zip |
Created a ListModel for ShopItems.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/sell.h | 25 | ||||
-rw-r--r-- | src/gui/shop.cpp | 9 |
2 files changed, 17 insertions, 17 deletions
diff --git a/src/gui/sell.h b/src/gui/sell.h index 1a5fabf5..86caff55 100644 --- a/src/gui/sell.h +++ b/src/gui/sell.h @@ -24,10 +24,7 @@ #ifndef _TMW_SELL_H #define _TMW_SELL_H -#include <vector> - #include <guichan/actionlistener.hpp> -#include <guichan/listmodel.hpp> #include "window.h" @@ -35,16 +32,15 @@ class Item; class Network; +class ShopItems; -struct ITEM_SHOP; /** * The sell dialog. * * \ingroup Interface */ -class SellDialog : public Window, public gcn::ActionListener, - public gcn::ListModel +class SellDialog : public Window, public gcn::ActionListener { public: /** @@ -55,6 +51,11 @@ class SellDialog : public Window, public gcn::ActionListener, SellDialog(Network *network); /** + * Destructor + */ + virtual ~SellDialog(); + + /** * Resets the dialog, clearing inventory. */ void reset(); @@ -70,20 +71,10 @@ class SellDialog : public Window, public gcn::ActionListener, void action(const std::string& eventId); /** - * Returns the number of items in the inventory. - */ - int getNumberOfElements(); - - /** * Mouse callback */ void mouseClick(int x, int y, int buton, int count); - /** - * Returns the name of item number i in the inventory. - */ - std::string getElementAt(int i); - private: Network *mNetwork; gcn::Button *sellButton; @@ -98,7 +89,7 @@ class SellDialog : public Window, public gcn::ActionListener, gcn::Label *quantityLabel; gcn::Slider *slider; - std::vector<ITEM_SHOP> shopInventory; + ShopItems *mShopItems; int m_maxItems; int m_amountItems; diff --git a/src/gui/shop.cpp b/src/gui/shop.cpp index 1dd498a8..3706cdf8 100644 --- a/src/gui/shop.cpp +++ b/src/gui/shop.cpp @@ -23,3 +23,12 @@ #include "shop.h" +int ShopItems::getNumberOfElements() +{ + return size(); +} + +std::string ShopItems::getElementAt(int i) +{ + return at(i).name; +} |