summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2006-11-05 15:22:13 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2006-11-05 15:22:13 +0000
commit6374ef220d8f46647190074338f868b5d6bb4a45 (patch)
treea833453c2e712c3e992f71433f6d21c8c379ad15 /src/gui
parentde61b658590630cfc59960c012c8e533b361a8b0 (diff)
downloadmana-client-6374ef220d8f46647190074338f868b5d6bb4a45.tar.gz
mana-client-6374ef220d8f46647190074338f868b5d6bb4a45.tar.bz2
mana-client-6374ef220d8f46647190074338f868b5d6bb4a45.tar.xz
mana-client-6374ef220d8f46647190074338f868b5d6bb4a45.zip
Merged 0.0 changes from revision 2800 to 2825 to trunk.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/buy.cpp36
-rw-r--r--src/gui/buy.h3
-rw-r--r--src/gui/sell.cpp56
-rw-r--r--src/gui/sell.h10
-rw-r--r--src/gui/shop.cpp44
-rw-r--r--src/gui/shop.h37
-rw-r--r--src/gui/shoplistbox.cpp200
-rw-r--r--src/gui/shoplistbox.h124
-rw-r--r--src/gui/updatewindow.cpp3
9 files changed, 462 insertions, 51 deletions
diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp
index 73f696b7..b681b683 100644
--- a/src/gui/buy.cpp
+++ b/src/gui/buy.cpp
@@ -26,14 +26,12 @@
#include <guichan/widgets/label.hpp>
#include "button.h"
-#include "listbox.h"
#include "scrollarea.h"
#include "shop.h"
#include "slider.h"
#include "../npc.h"
-#include "../resources/iteminfo.h"
#include "../resources/itemmanager.h"
#include "../utils/tostring.h"
@@ -45,8 +43,8 @@ BuyDialog::BuyDialog():
{
mShopItems = new ShopItems;
- mItemList = new ListBox(mShopItems);
- mScrollArea = new ScrollArea(mItemList);
+ mShopItemList = new ShopListBox(mShopItems, mShopItems);
+ mScrollArea = new ScrollArea(mShopItemList);
mSlider = new Slider(1.0);
mQuantityLabel = new gcn::Label("0");
mMoneyLabel = new gcn::Label("Price : 0 GP / 0 GP");
@@ -60,7 +58,7 @@ BuyDialog::BuyDialog():
setContentSize(260, 210);
mScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
mScrollArea->setDimension(gcn::Rectangle(5, 5, 250, 110));
- mItemList->setDimension(gcn::Rectangle(5, 5, 238, 110));
+ mShopItemList->setDimension(gcn::Rectangle(5, 5, 238, 110));
mSlider->setDimension(gcn::Rectangle(5, 120, 200, 10));
mSlider->setEnabled(false);
@@ -84,11 +82,11 @@ BuyDialog::BuyDialog():
mItemEffectLabel->setDimension(gcn::Rectangle(5, 150, 240, 14));
mItemDescLabel->setDimension(gcn::Rectangle(5, 169, 240, 14));
- mItemList->setEventId("item");
+ mShopItemList->setEventId("item");
mSlider->setEventId("slider");
- mItemList->addActionListener(this);
- mItemList->addSelectionListener(this);
+ mShopItemList->addActionListener(this);
+ mShopItemList->addSelectionListener(this);
mSlider->addActionListener(this);
add(mScrollArea);
@@ -113,6 +111,7 @@ BuyDialog::~BuyDialog()
void BuyDialog::setMoney(int amount)
{
mMoney = amount;
+ mShopItemList->setPlayersMoney(amount);
mMoneyLabel->setCaption("Price : 0 GP / " + toString(mMoney) + " GP");
mMoneyLabel->adjustSize();
}
@@ -125,7 +124,7 @@ void BuyDialog::reset()
mAmountItems = 0;
// Reset Previous Selected Items to prevent failing asserts
- mItemList->setSelected(-1);
+ mShopItemList->setSelected(-1);
mIncreaseButton->setEnabled(false);
mDecreaseButton->setEnabled(false);
mQuantityLabel->setCaption("0");
@@ -138,20 +137,13 @@ void BuyDialog::reset()
void BuyDialog::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;
-
- mShopItems->push_back(item_shop);
- mItemList->adjustSize();
+ mShopItems->addItem(id, price);
+ mShopItemList->adjustSize();
}
void BuyDialog::action(const std::string &eventId, gcn::Widget *widget)
{
- int selectedItem = mItemList->getSelected();
+ int selectedItem = mShopItemList->getSelected();
if (eventId == "item")
{
@@ -169,7 +161,7 @@ void BuyDialog::action(const std::string &eventId, gcn::Widget *widget)
// If no item was selected, none can be bought, otherwise
// calculate how many the player can afford
- mMaxItems = (mItemList->getSelected() == -1) ? 0 :
+ mMaxItems = (mShopItemList->getSelected() == -1) ? 0 :
mMoney / mShopItems->at(selectedItem).price;
// When at least one item can be bought, enable the slider and the
@@ -184,7 +176,7 @@ void BuyDialog::action(const std::string &eventId, gcn::Widget *widget)
}
// The following actions require a valid selection
- if (selectedItem < 0 || selectedItem >= int(mShopItems->size()))
+ if (selectedItem < 0 || selectedItem >= int(mShopItems->getNumberOfElements()))
{
return;
}
@@ -269,7 +261,7 @@ void BuyDialog::action(const std::string &eventId, gcn::Widget *widget)
void BuyDialog::selectionChanged(const SelectionEvent &event)
{
- int selectedItem = mItemList->getSelected();
+ int selectedItem = mShopItemList->getSelected();
if (selectedItem > -1)
{
diff --git a/src/gui/buy.h b/src/gui/buy.h
index f5c163e1..b83b6f2f 100644
--- a/src/gui/buy.h
+++ b/src/gui/buy.h
@@ -28,6 +28,7 @@
#include "window.h"
#include "selectionlistener.h"
+#include "shoplistbox.h"
#include "../guichanfwd.h"
@@ -96,7 +97,7 @@ class BuyDialog : public Window, public gcn::ActionListener, SelectionListener
gcn::Button *mQuitButton;
gcn::Button *mIncreaseButton;
gcn::Button *mDecreaseButton;
- ListBox *mItemList;
+ ShopListBox *mShopItemList;
gcn::ScrollArea *mScrollArea;
gcn::Label *mItemDescLabel;
gcn::Label *mItemEffectLabel;
diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp
index 9c25aced..fd63633c 100644
--- a/src/gui/sell.cpp
+++ b/src/gui/sell.cpp
@@ -28,7 +28,7 @@
#include <guichan/widgets/label.hpp>
#include "button.h"
-#include "listbox.h"
+#include "shoplistbox.h"
#include "scrollarea.h"
#include "shop.h"
#include "slider.h"
@@ -47,11 +47,11 @@ SellDialog::SellDialog():
{
mShopItems = new ShopItems();
- mItemList = new ListBox(mShopItems);
- ScrollArea *scrollArea = new ScrollArea(mItemList);
+ mShopItemList = new ShopListBox(mShopItems, mShopItems);
+ ScrollArea *scrollArea = new ScrollArea(mShopItemList);
mSlider = new Slider(1.0);
mQuantityLabel = new gcn::Label("0");
- mMoneyLabel = new gcn::Label("Price: 0");
+ mMoneyLabel = new gcn::Label("Money: 0 GP / Total: 0 GP");
mItemDescLabel = new gcn::Label("Description:");
mItemEffectLabel = new gcn::Label("Effect:");
mIncreaseButton = new Button("+", "+", this);
@@ -63,7 +63,7 @@ SellDialog::SellDialog():
setContentSize(260, 210);
scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
scrollArea->setDimension(gcn::Rectangle(5, 5, 250, 110));
- mItemList->setDimension(gcn::Rectangle(5, 5, 238, 110));
+ mShopItemList->setDimension(gcn::Rectangle(5, 5, 238, 110));
mSlider->setDimension(gcn::Rectangle(5, 120, 200, 10));
mSlider->setEnabled(false);
@@ -87,11 +87,13 @@ SellDialog::SellDialog():
quitButton->setPosition(208, 186);
- mItemList->setEventId("item");
+ mShopItemList->setEventId("item");
mSlider->setEventId("mSlider");
- mItemList->addActionListener(this);
- mItemList->addSelectionListener(this);
+ mShopItemList->setPriceCheck(false);
+
+ mShopItemList->addActionListener(this);
+ mShopItemList->addSelectionListener(this);
mSlider->addActionListener(this);
add(scrollArea);
@@ -121,13 +123,14 @@ void SellDialog::reset()
mQuantityLabel->setCaption("0");
mQuantityLabel->adjustSize();
- mMoneyLabel->setCaption("Price: 0");
+ mMoneyLabel->setCaption("Money: 0 GP / Total: "
+ + toString(mPlayerMoney) + " GP");
mMoneyLabel->adjustSize();
mItemDescLabel->setCaption("");
mItemEffectLabel->setCaption("");
// Reset Previous Selected Items to prevent failing asserts
- mItemList->setSelected(-1);
+ mShopItemList->setSelected(-1);
mIncreaseButton->setEnabled(false);
mDecreaseButton->setEnabled(false);
}
@@ -144,14 +147,15 @@ void SellDialog::addItem(Item *item, int price)
item_shop.index = item->getInvIndex();
item_shop.id = item->getId();
item_shop.quantity = item->getQuantity();
+ item_shop.image = item->getInfo().getImage();
mShopItems->push_back(item_shop);
- mItemList->adjustSize();
+ mShopItemList->adjustSize();
}
void SellDialog::action(const std::string &eventId, gcn::Widget *widget)
{
- int selectedItem = mItemList->getSelected();
+ int selectedItem = mShopItemList->getSelected();
if (eventId == "item")
{
@@ -160,19 +164,22 @@ void SellDialog::action(const std::string &eventId, gcn::Widget *widget)
mDecreaseButton->setEnabled(false);
mSellButton->setEnabled(false);
- mQuantityLabel->setCaption("0");
mQuantityLabel->adjustSize();
- mMoneyLabel->setCaption("Price: 0");
+ mMoneyLabel->setCaption("Money: 0 GP / Total: "
+ + toString(mPlayerMoney) + " GP");
mMoneyLabel->adjustSize();
if (selectedItem > -1) {
mSlider->setEnabled(true);
mIncreaseButton->setEnabled(true);
mMaxItems = mShopItems->at(selectedItem).quantity;
+ mQuantityLabel->setCaption("0 / " + toString(mMaxItems));
} else {
mSlider->setEnabled(false);
mIncreaseButton->setEnabled(false);
+ mQuantityLabel->setCaption("0");
}
+ mQuantityLabel->adjustSize();
}
else if (eventId == "quit")
{
@@ -181,7 +188,7 @@ void SellDialog::action(const std::string &eventId, gcn::Widget *widget)
}
// The following actions require a valid item selection
- if (selectedItem == -1 || selectedItem >= int(mShopItems->size())) {
+ if (selectedItem == -1 || selectedItem >= int(mShopItems->getNumberOfElements())) {
return;
}
@@ -224,14 +231,16 @@ void SellDialog::action(const std::string &eventId, gcn::Widget *widget)
*/
mMaxItems -= mAmountItems;
+ mShopItems->getShop()->at(selectedItem).quantity = mMaxItems;
mAmountItems = 0;
mSlider->setValue(0);
mSlider->setEnabled(mMaxItems != 0);
// All were sold
if (!mMaxItems) {
- mItemList->setSelected(-1);
- mShopItems->erase(mShopItems->begin() + selectedItem);
+
+ mShopItemList->setSelected(-1);
+ mShopItems->getShop()->erase(mShopItems->getShop()->begin() + selectedItem);
}
// Update only when there are items left, the entry doesn't exist
@@ -243,11 +252,12 @@ void SellDialog::action(const std::string &eventId, gcn::Widget *widget)
if (updateButtonsAndLabels)
{
// Update labels
- mQuantityLabel->setCaption(toString(mAmountItems));
+ mQuantityLabel->setCaption(toString(mAmountItems) + " / " + toString(mMaxItems));
mQuantityLabel->adjustSize();
int price = mAmountItems * mShopItems->at(selectedItem).price;
- mMoneyLabel->setCaption("Price: " + toString(price));
+ mMoneyLabel->setCaption("Money: " + toString(price) + " GP / Total: "
+ + toString(price + mPlayerMoney) + " GP");
mMoneyLabel->adjustSize();
// Update Buttons
@@ -259,7 +269,7 @@ void SellDialog::action(const std::string &eventId, gcn::Widget *widget)
void SellDialog::selectionChanged(const SelectionEvent &event)
{
- int selectedItem = mItemList->getSelected();
+ int selectedItem = mShopItemList->getSelected();
if (selectedItem > -1)
{
@@ -275,3 +285,9 @@ void SellDialog::selectionChanged(const SelectionEvent &event)
mItemEffectLabel->setCaption("Effect");
}
}
+
+void SellDialog::setMoney(int amount)
+{
+ mPlayerMoney = amount;
+ mShopItemList->setPlayersMoney(amount);
+}
diff --git a/src/gui/sell.h b/src/gui/sell.h
index 69f8b089..ba324576 100644
--- a/src/gui/sell.h
+++ b/src/gui/sell.h
@@ -33,7 +33,7 @@
class Item;
class ShopItems;
-class ListBox;
+class ShopListBox;
/**
* The sell dialog.
@@ -77,11 +77,16 @@ class SellDialog : public Window, gcn::ActionListener, SelectionListener
*/
void selectionChanged(const SelectionEvent &event);
+ /**
+ * Gives Player's Money amount
+ */
+ void setMoney(int amount);
+
private:
gcn::Button *mSellButton;
gcn::Button *mIncreaseButton;
gcn::Button *mDecreaseButton;
- ListBox *mItemList;
+ ShopListBox *mShopItemList;
gcn::Label *mMoneyLabel;
gcn::Label *mItemDescLabel;
gcn::Label *mItemEffectLabel;
@@ -89,6 +94,7 @@ class SellDialog : public Window, gcn::ActionListener, SelectionListener
gcn::Slider *mSlider;
ShopItems *mShopItems;
+ int mPlayerMoney;
int mMaxItems;
int mAmountItems;
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;
}
diff --git a/src/gui/shop.h b/src/gui/shop.h
index fb1f33fd..de452b5c 100644
--- a/src/gui/shop.h
+++ b/src/gui/shop.h
@@ -28,22 +28,34 @@
#include <vector>
#include <guichan/listmodel.hpp>
+#include "../resources/image.h"
struct ITEM_SHOP {
+ short id;
std::string name;
+ Image *image;
int price;
- short id;
int index;
int quantity;
};
-class ShopItems : public std::vector<ITEM_SHOP>, public gcn::ListModel
+class ShopItems : public gcn::ListModel
{
public:
/**
* Destructor
*/
- virtual ~ShopItems() {};
+ ~ShopItems();
+
+ /**
+ * Adds an item and its associated picture
+ */
+ void addItem(short id, int price);
+
+ /**
+ * Convenience function for adding items
+ */
+ void push_back(ITEM_SHOP item_shop);
/**
* Returns the number of items in the shop.
@@ -54,6 +66,25 @@ class ShopItems : public std::vector<ITEM_SHOP>, public gcn::ListModel
* Returns the name of item number i in the shop.
*/
std::string getElementAt(int i);
+
+ /**
+ * Returns the item number i in the shop.
+ */
+ ITEM_SHOP at(int i);
+
+ /**
+ * Clear the vector.
+ */
+ void clear();
+
+ /**
+ * Direct access to the vector
+ */
+ std::vector<ITEM_SHOP>* getShop();
+
+ private:
+ std::vector<ITEM_SHOP> mItemsShop;
+
};
#endif
diff --git a/src/gui/shoplistbox.cpp b/src/gui/shoplistbox.cpp
new file mode 100644
index 00000000..61abff35
--- /dev/null
+++ b/src/gui/shoplistbox.cpp
@@ -0,0 +1,200 @@
+/*
+ * The Mana World
+ * Copyright 2004 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * The Mana World is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * The Mana World is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with The Mana World; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * $Id: listbox.cpp 2655 2006-09-03 21:25:02Z b_lindeijer $
+ */
+
+#include "shoplistbox.h"
+
+#include "selectionlistener.h"
+
+#include <guichan/font.hpp>
+#include <guichan/graphics.hpp>
+#include <guichan/listmodel.hpp>
+#include <guichan/mouseinput.hpp>
+#include <guichan/imagefont.hpp>
+#include <guichan/basiccontainer.hpp>
+
+#include "../graphics.h"
+
+const int ITEM_SPRITE_HEIGHT = 32;
+
+ShopListBox::ShopListBox(gcn::ListModel *listModel):
+ gcn::ListBox(listModel),
+ mMousePressed(false),
+ mPlayerMoney(0)
+{
+ mRowHeight = getFont()->getHeight();
+ mPriceCheck = true;
+}
+
+ShopListBox::ShopListBox(gcn::ListModel *listModel, ShopItems *shopListModel):
+ gcn::ListBox(listModel),
+ mMousePressed(false),
+ mPlayerMoney(0),
+ mShopItems(shopListModel)
+{
+ mRowHeight = (getFont()->getHeight() > ITEM_SPRITE_HEIGHT ?
+ getFont()->getHeight() : ITEM_SPRITE_HEIGHT);
+ mPriceCheck = true;
+}
+
+
+void ShopListBox::setPlayersMoney(int money)
+{
+ mPlayerMoney = money;
+}
+
+void ShopListBox::draw(gcn::Graphics *graphics)
+{
+ if (mListModel == NULL) {
+ return;
+ }
+
+ graphics->setFont(getFont());
+
+ // Draw the list elements
+ for (int i = 0, y = 0; i < mListModel->getNumberOfElements(); ++i, y += mRowHeight)
+ {
+ graphics->setColor(gcn::Color(0xffffff));
+ if (mShopItems != NULL)
+ {
+ if(mPlayerMoney < mShopItems->at(i).price && mPriceCheck)
+ {
+ graphics->setColor(gcn::Color(0x919191));
+ }
+ }
+ graphics->fillRectangle(gcn::Rectangle(0, y, getWidth(), mRowHeight));
+ if (mShopItems)
+ dynamic_cast<Graphics*>(graphics)->drawImage(mShopItems->at(i).image, 1, y);
+ graphics->drawText(mListModel->getElementAt(i), ITEM_SPRITE_HEIGHT, y);
+ }
+
+ // Draw rectangle below the selected list element and the list element
+ // not shown.
+ if (mSelected >= 0) {
+ graphics->setColor(gcn::Color(110, 160, 255));
+ graphics->fillRectangle(gcn::Rectangle(0, mRowHeight * mSelected,
+ getWidth(), mRowHeight));
+ if (mShopItems)
+ dynamic_cast<Graphics*>(graphics)->drawImage(
+ mShopItems->at(mSelected).image, 1, mRowHeight * mSelected);
+ graphics->drawText(mListModel->getElementAt(mSelected),
+ ITEM_SPRITE_HEIGHT, mRowHeight * mSelected);
+ }
+}
+
+void ShopListBox::setSelected(int selected)
+{
+ gcn::ListBox::setSelected(selected);
+ if (mListModel != NULL)
+ {
+ gcn::BasicContainer *par = getParent();
+ if (par == NULL)
+ {
+ return;
+ }
+
+ gcn::Rectangle scroll;
+
+ if (mSelected < 0)
+ {
+ scroll.y = 0;
+ }
+ else
+ {
+ scroll.y = mRowHeight * mSelected;
+ }
+
+ scroll.height = mRowHeight;
+ par->showWidgetPart(this, scroll);
+ }
+ fireSelectionChangedEvent();
+}
+
+void ShopListBox::mousePress(int x, int y, int button)
+{
+
+ bool enoughMoney = false;
+ if (button == gcn::MouseInput::LEFT && hasMouse())
+ {
+ if (mShopItems)
+ {
+ if(mPlayerMoney >= mShopItems->at(y / mRowHeight).price)
+ enoughMoney = true;
+ }
+ else // Old Behaviour
+ enoughMoney = true;
+
+ if (!mPriceCheck)
+ enoughMoney = true;
+
+ if (enoughMoney)
+ {
+ setSelected(y / mRowHeight);
+ generateAction();
+ mMousePressed = true;
+ }
+ }
+}
+
+void ShopListBox::mouseRelease(int x, int y, int button)
+{
+ gcn::ListBox::mouseRelease(x, y, button);
+
+ mMousePressed = false;
+}
+
+void ShopListBox::mouseMotion(int x, int y)
+{
+ gcn::ListBox::mouseMotion(x, y);
+
+ // Pretend mouse is pressed continuously while dragged. Causes list
+ // selection to be updated as is default in many GUIs.
+ if (mMousePressed)
+ {
+ mousePress(x, y, gcn::MouseInput::LEFT);
+ }
+}
+
+void ShopListBox::fireSelectionChangedEvent()
+{
+ SelectionEvent event(this);
+ SelectionListeners::iterator i_end = mListeners.end();
+ SelectionListeners::iterator i;
+
+ for (i = mListeners.begin(); i != i_end; ++i)
+ {
+ (*i)->selectionChanged(event);
+ }
+}
+
+void ShopListBox::adjustSize()
+{
+ if (mListModel != NULL)
+ {
+ setHeight(mRowHeight * mListModel->getNumberOfElements());
+ }
+}
+
+void ShopListBox::setPriceCheck(bool check)
+{
+ mPriceCheck = check;
+}
diff --git a/src/gui/shoplistbox.h b/src/gui/shoplistbox.h
new file mode 100644
index 00000000..2dff8977
--- /dev/null
+++ b/src/gui/shoplistbox.h
@@ -0,0 +1,124 @@
+/*
+ * The Mana World
+ * Copyright 2004 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * The Mana World is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * The Mana World is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with The Mana World; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * $Id: listbox.h 2655 2006-09-03 21:25:02Z b_lindeijer $
+ */
+
+#ifndef _TMW_LISTBOX_H
+#define _TMW_LISTBOX_H
+
+#include <guichan/widgets/listbox.hpp>
+#include "shop.h"
+
+class SelectionListener;
+
+/**
+ * A list box, meant to be used inside a scroll area. Same as the Guichan list
+ * box except this one doesn't have a background, instead completely relying
+ * on the scroll area. It also adds selection listener functionality.
+ *
+ * \ingroup GUI
+ */
+class ShopListBox : public gcn::ListBox
+{
+ public:
+ /**
+ * Constructor.
+ */
+ ShopListBox(gcn::ListModel *listModel);
+
+ /**
+ * Constructor with shopitems
+ */
+ ShopListBox(gcn::ListModel *listModel, ShopItems *shopListModel);
+
+ /**
+ * Draws the list box.
+ */
+ void draw(gcn::Graphics *graphics);
+
+ void mousePress(int x, int y, int button);
+ void mouseRelease(int x, int y, int button);
+ void mouseMotion(int x, int y);
+
+ /**
+ * Adds a listener to the list that's notified each time a change to
+ * the selection occurs.
+ */
+ void addSelectionListener(SelectionListener *listener)
+ {
+ mListeners.push_back(listener);
+ }
+
+ /**
+ * Removes a listener from the list that's notified each time a change
+ * to the selection occurs.
+ */
+ void removeSelectionListener(SelectionListener *listener)
+ {
+ mListeners.remove(listener);
+ }
+
+ /**
+ * Sets the index of the selected element.
+ */
+ void setSelected(int selected);
+
+ /**
+ * gives information about the current player's money
+ */
+ void setPlayersMoney(int money);
+
+ /**
+ * Adjust List draw size
+ */
+ void adjustSize();
+
+ /**
+ * Set on/off the disabling of too expensive items.
+ * (Good for selling mode.)
+ */
+ void setPriceCheck(bool check);
+
+ private:
+ /**
+ * Sends out selection events to the list of selection listeners.
+ */
+ void fireSelectionChangedEvent();
+
+ bool mMousePressed; /**< Keeps track of mouse pressed status. */
+
+ std::list<SelectionListener*> mListeners;
+
+ int mPlayerMoney;
+
+ /**
+ * Keeps another pointer to the same listModel, permitting to
+ * use the ShopItems specific functions.
+ */
+ ShopItems *mShopItems;
+
+ int mRowHeight; /**< Row Height */
+
+ bool mPriceCheck;
+
+};
+
+#endif
diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp
index 510e10ba..c29906a1 100644
--- a/src/gui/updatewindow.cpp
+++ b/src/gui/updatewindow.cpp
@@ -86,7 +86,8 @@ UpdaterWindow::UpdaterWindow():
mCancelButton->requestFocus();
setLocationRelativeTo(getParent());
- mUpdateHost = config.getValue("updatehost", "themanaworld.org/files");
+ mUpdateHost =
+ config.getValue("updatehost", "http://updates.themanaworld.org");
mBasePath = config.getValue("homeDir", ".");
// Try to download the updates list