summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/equipmentwindow.cpp13
-rw-r--r--src/gui/inventorywindow.cpp14
-rw-r--r--src/gui/itemcontainer.cpp2
-rw-r--r--src/gui/popupmenu.cpp14
-rw-r--r--src/gui/trade.cpp8
-rw-r--r--src/gui/trade.h2
6 files changed, 16 insertions, 37 deletions
diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp
index 1ae887bc..27c97ea0 100644
--- a/src/gui/equipmentwindow.cpp
+++ b/src/gui/equipmentwindow.cpp
@@ -50,9 +50,6 @@ void EquipmentWindow::draw(gcn::Graphics *graphics)
// Draw window graphics
Window::draw(graphics);
- Item *item;
- Image *image;
-
// Rectangles around items are black
graphics->setColor(gcn::Color(0, 0, 0));
@@ -60,17 +57,17 @@ void EquipmentWindow::draw(gcn::Graphics *graphics)
graphics->drawRectangle(gcn::Rectangle(10 + 36 * (i % 4),
36 * (i / 4) + 25, 32, 32));
- if (!(item = mEquipment->getEquipment(i))) {
- continue;
- }
+ int item = mEquipment->getEquipment(i);
+ if (!item) continue;
- image = item->getInfo().getImage();
+ Image *image = Item(item).getInfo().getImage();
static_cast<Graphics*>(graphics)->
drawImage(image, 36 * (i % 4) + 10, 36 * (i / 4) + 25);
}
graphics->drawRectangle(gcn::Rectangle(160, 25, 32, 32));
+ /*
if (!(item = mEquipment->getArrows())) {
return;
}
@@ -80,4 +77,6 @@ void EquipmentWindow::draw(gcn::Graphics *graphics)
static_cast<Graphics*>(graphics)->drawImage(image, 160, 25);
graphics->drawText(toString(item->getQuantity()), 170, 62,
gcn::Graphics::CENTER);
+ */
+ return;
}
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index 2018c75a..2ad35095 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -109,12 +109,7 @@ void InventoryWindow::action(const gcn::ActionEvent &event)
if (event.getId() == "use") {
if (item->isEquipment()) {
- if (item->isEquipped()) {
- player_node->unequipItem(item);
- }
- else {
- player_node->equipItem(item);
- }
+ player_node->equipItem(item);
}
else {
player_node->useItem(item);
@@ -215,12 +210,7 @@ void InventoryWindow::updateButtons()
if ((item = mItems->getItem()) && item->isEquipment())
{
- if (item->isEquipped()) {
- mUseButton->setCaption("Unequip");
- }
- else {
- mUseButton->setCaption("Equip");
- }
+ mUseButton->setCaption("Equip");
}
else {
mUseButton ->setCaption("Use");
diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp
index 0e5bcce9..444be2a2 100644
--- a/src/gui/itemcontainer.cpp
+++ b/src/gui/itemcontainer.cpp
@@ -116,7 +116,7 @@ ItemContainer::draw(gcn::Graphics *graphics)
// Draw item caption
graphics->drawText(
- (item->isEquipped() ? "Eq." : toString(item->getQuantity())),
+ toString(item->getQuantity()),
itemX + gridWidth / 2,
itemY + gridHeight - 11,
gcn::Graphics::CENTER);
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index cc764d35..f308bbfd 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -168,14 +168,7 @@ void PopupMenu::handleLink(const std::string& link)
assert(mItem);
if (mItem->isEquipment())
{
- if (mItem->isEquipped())
- {
- player_node->unequipItem(mItem);
- }
- else
- {
- player_node->equipItem(mItem);
- }
+ player_node->equipItem(mItem);
}
else
{
@@ -221,10 +214,7 @@ void PopupMenu::showPopup(int x, int y, Item *item)
if (item->isEquipment())
{
- if (item->isEquipped())
- mBrowserBox->addRow("@@use|Unequip@@");
- else
- mBrowserBox->addRow("@@use|Equip@@");
+ mBrowserBox->addRow("@@use|Equip@@");
}
else
mBrowserBox->addRow("@@use|Use@@");
diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp
index 37faafdf..337bd7ea 100644
--- a/src/gui/trade.cpp
+++ b/src/gui/trade.cpp
@@ -137,12 +137,12 @@ void TradeWindow::addMoney(int amount)
mMoneyLabel->adjustSize();
}
-void TradeWindow::addItem(int id, bool own, int quantity, bool equipment)
+void TradeWindow::addItem(int id, bool own, int quantity)
{
if (own) {
- mMyInventory->addItem(id, quantity, equipment);
+ mMyInventory->addItem(id, quantity);
} else {
- mPartnerInventory->addItem(id, quantity, equipment);
+ mPartnerInventory->addItem(id, quantity);
}
}
@@ -217,7 +217,7 @@ void TradeWindow::receivedOk(bool own)
void TradeWindow::tradeItem(Item *item, int quantity)
{
Net::GameServer::Player::tradeItem(item->getInvIndex(), quantity);
- addItem(item->getId(), true, quantity, item->isEquipment());
+ addItem(item->getId(), true, quantity);
item->increaseQuantity(-quantity);
}
diff --git a/src/gui/trade.h b/src/gui/trade.h
index 1c64c255..bffda13f 100644
--- a/src/gui/trade.h
+++ b/src/gui/trade.h
@@ -64,7 +64,7 @@ class TradeWindow : public Window, gcn::ActionListener, SelectionListener
/**
* Add an item to the trade window.
*/
- void addItem(int id, bool own, int quantity, bool equipment);
+ void addItem(int id, bool own, int quantity);
/**
* Remove a item from the trade window.