summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2010-03-25 12:18:43 -0600
committerJared Adams <jaxad0127@gmail.com>2010-03-25 12:42:43 -0600
commitf781215c6401343d287798b58b08183e71ef57e3 (patch)
treeb07001f8ee295c4ba8617c5168805269530bd9d1
parentbf6cb46d9b06b06470efd5ad3ebae7e274f6906f (diff)
downloadmana-f781215c6401343d287798b58b08183e71ef57e3.tar.gz
mana-f781215c6401343d287798b58b08183e71ef57e3.tar.bz2
mana-f781215c6401343d287798b58b08183e71ef57e3.tar.xz
mana-f781215c6401343d287798b58b08183e71ef57e3.zip
Merge StorageWindow into InventoryWindow
Reviewed-by: Chuck Miller
-rw-r--r--mana.cbp2
-rw-r--r--mana.files2
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/Makefile.am2
-rw-r--r--src/game.cpp3
-rw-r--r--src/gui/inventorywindow.cpp146
-rw-r--r--src/gui/inventorywindow.h35
-rw-r--r--src/gui/itemamount.cpp9
-rw-r--r--src/gui/popupmenu.cpp3
-rw-r--r--src/gui/storagewindow.cpp216
-rw-r--r--src/gui/storagewindow.h113
-rw-r--r--src/localplayer.cpp1
-rw-r--r--src/net/ea/inventoryhandler.cpp4
-rw-r--r--src/net/ea/inventoryhandler.h4
-rw-r--r--src/net/ea/playerhandler.cpp1
15 files changed, 137 insertions, 406 deletions
diff --git a/mana.cbp b/mana.cbp
index 8210f02b..d8cde0e9 100644
--- a/mana.cbp
+++ b/mana.cbp
@@ -223,8 +223,6 @@
<Unit filename="src\gui\speechbubble.h" />
<Unit filename="src\gui\statuswindow.cpp" />
<Unit filename="src\gui\statuswindow.h" />
- <Unit filename="src\gui\storagewindow.cpp" />
- <Unit filename="src\gui\storagewindow.h" />
<Unit filename="src\gui\textdialog.cpp" />
<Unit filename="src\gui\textdialog.h" />
<Unit filename="src\gui\textpopup.cpp" />
diff --git a/mana.files b/mana.files
index b0216f10..eb5f8ad2 100644
--- a/mana.files
+++ b/mana.files
@@ -170,8 +170,6 @@
./src/gui/speechbubble.h
./src/gui/statuswindow.cpp
./src/gui/statuswindow.h
-./src/gui/storagewindow.cpp
-./src/gui/storagewindow.h
./src/gui/textdialog.cpp
./src/gui/textdialog.h
./src/gui/textpopup.cpp
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a63140e9..a0bcac83 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -290,8 +290,6 @@ SET(SRCS
gui/specialswindow.h
gui/statuswindow.cpp
gui/statuswindow.h
- gui/storagewindow.cpp
- gui/storagewindow.h
gui/textdialog.cpp
gui/textdialog.h
gui/textpopup.cpp
diff --git a/src/Makefile.am b/src/Makefile.am
index 1b666d01..035d4e1f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -189,8 +189,6 @@ mana_SOURCES = gui/widgets/avatarlistbox.cpp \
gui/specialswindow.h \
gui/statuswindow.cpp \
gui/statuswindow.h \
- gui/storagewindow.cpp \
- gui/storagewindow.h \
gui/textdialog.cpp \
gui/textdialog.h \
gui/textpopup.cpp \
diff --git a/src/game.cpp b/src/game.cpp
index 0f45d436..f2ad6109 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -60,7 +60,6 @@
#include "gui/setup.h"
#include "gui/socialwindow.h"
#include "gui/specialswindow.h"
-#include "gui/storagewindow.h"
#include "gui/skilldialog.h"
#include "gui/statuswindow.h"
#include "gui/textdialog.h"
@@ -156,7 +155,7 @@ static void createGuiWindows()
equipmentWindow = new EquipmentWindow(player_node->mEquipment.get());
statusWindow = new StatusWindow;
miniStatusWindow = new MiniStatusWindow;
- inventoryWindow = new InventoryWindow;
+ inventoryWindow = new InventoryWindow(player_node->getInventory(), true);
skillDialog = new SkillDialog;
minimap = new Minimap;
helpWindow = new HelpWindow;
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index 6291d524..18705ada 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -53,10 +53,12 @@
#include <string>
-InventoryWindow::InventoryWindow():
- Window(_("Inventory")),
- mSplit(false),
- mItemDesc(false)
+InventoryWindow::WindowList InventoryWindow::instances;
+
+InventoryWindow::InventoryWindow(Inventory *inventory, bool isMainInventory):
+ Window(isMainInventory ? _("Inventory") : _("Storage")),
+ mInventory(inventory),
+ mSplit(false)
{
setWindowName("Inventory");
setupWindow->registerWindowForReset(this);
@@ -69,54 +71,79 @@ InventoryWindow::InventoryWindow():
setMinHeight(179);
addKeyListener(this);
- std::string longestUseString = getFont()->getWidth(_("Equip")) >
- getFont()->getWidth(_("Use")) ?
- _("Equip") : _("Use");
-
- if (getFont()->getWidth(longestUseString) <
- getFont()->getWidth(_("Unequip")))
- {
- longestUseString = _("Unequip");
- }
-
- mUseButton = new Button(longestUseString, "use", this);
- mDropButton = new Button(_("Drop..."), "drop", this);
- mSplitButton = new Button(_("Split"), "split", this);
- mOutfitButton = new Button(_("Outfits"), "outfit", this);
- mItems = new ItemContainer(player_node->getInventory());
+ mItems = new ItemContainer(mInventory);
mItems->addSelectionListener(this);
gcn::ScrollArea *invenScroll = new ScrollArea(mItems);
invenScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
mSlotsLabel = new Label(_("Slots:"));
- mWeightLabel = new Label(_("Weight:"));
-
mSlotsBar = new ProgressBar(0.0f, 100, 20, Theme::PROG_INVY_SLOTS);
- mWeightBar = new ProgressBar(0.0f, 100, 20, Theme::PROG_WEIGHT);
-
- place(0, 0, mWeightLabel).setPadding(3);
- place(1, 0, mWeightBar, 3);
- place(4, 0, mSlotsLabel).setPadding(3);
- place(5, 0, mSlotsBar, 2);
- place(0, 1, invenScroll, 7).setPadding(3);
- place(0, 2, mUseButton);
- place(1, 2, mDropButton);
- place(2, 2, mSplitButton);
- place(6, 2, mOutfitButton);
+
+ if (isMainInventory)
+ {
+ std::string equip = _("Equip");
+ std::string use = _("Use");
+ std::string unequip = _("Unequip");
+
+ std::string longestUseString = getFont()->getWidth(equip) >
+ getFont()->getWidth(use) ? equip : use;
+
+ if (getFont()->getWidth(longestUseString) <
+ getFont()->getWidth(unequip))
+ {
+ longestUseString = unequip;
+ }
+
+ mUseButton = new Button(longestUseString, "use", this);
+ mDropButton = new Button(_("Drop..."), "drop", this);
+ mSplitButton = new Button(_("Split"), "split", this);
+ mOutfitButton = new Button(_("Outfits"), "outfit", this);
+
+ mWeightLabel = new Label(_("Weight:"));
+ mWeightBar = new ProgressBar(0.0f, 100, 20, Theme::PROG_WEIGHT);
+
+ place(0, 0, mWeightLabel).setPadding(3);
+ place(1, 0, mWeightBar, 3);
+ place(4, 0, mSlotsLabel).setPadding(3);
+ place(5, 0, mSlotsBar, 2);
+ place(0, 1, invenScroll, 7).setPadding(3);
+ place(0, 2, mUseButton);
+ place(1, 2, mDropButton);
+ place(2, 2, mSplitButton);
+ place(6, 2, mOutfitButton);
+
+ updateWeight();
+ }
+ else
+ {
+ mStoreButton = new Button(_("Store"), "store", this);
+ mRetrieveButton = new Button(_("Retrieve"), "retrieve", this);
+
+ place(0, 0, mSlotsLabel).setPadding(3);
+ place(1, 0, mSlotsBar, 3);
+ place(0, 1, invenScroll, 4, 4);
+ place(0, 5, mStoreButton);
+ place(1, 5, mRetrieveButton);
+ }
Layout &layout = getLayout();
layout.setRowHeight(1, Layout::AUTO_SET);
- player_node->getInventory()->addInventoyListener(this);
+ mInventory->addInventoyListener(this);
+
+ instances.push_back(this);
loadWindowState();
- updateWeight();
- slotsChanged(player_node->getInventory());
+ slotsChanged(mInventory);
+
+ if (!isMainInventory)
+ setVisible(true);
}
InventoryWindow::~InventoryWindow()
{
+ mInventory->removeInventoyListener(this);
}
void InventoryWindow::action(const gcn::ActionEvent &event)
@@ -157,6 +184,27 @@ void InventoryWindow::action(const gcn::ActionEvent &event)
ItemAmountWindow::showWindow(ItemAmountWindow::ItemSplit, this, item,
(item->getQuantity() - 1));
}
+ else if (event.getId() == "store")
+ {
+ if (!inventoryWindow->isVisible()) return;
+
+ Item *item = inventoryWindow->getSelectedItem();
+
+ if (!item)
+ return;
+
+ ItemAmountWindow::showWindow(ItemAmountWindow::StoreAdd, this, item);
+ }
+ else if (event.getId() == "retrieve")
+ {
+ Item *item = mItems->getSelectedItem();
+
+ if (!item)
+ return;
+
+ ItemAmountWindow::showWindow(ItemAmountWindow::StoreRemove, this,
+ item);
+ }
}
Item *InventoryWindow::getSelectedItem() const
@@ -185,15 +233,16 @@ void InventoryWindow::mouseClicked(gcn::MouseEvent &event)
if (event.getButton() == gcn::MouseEvent::LEFT)
{
- if (StorageWindow::isActive() &&
- keyboard.isKeyActive(keyboard.KEY_EMOTE))
+ if (isStorageActive() && keyboard.isKeyActive(keyboard.KEY_EMOTE))
{
Item *item = mItems->getSelectedItem();
if(!item)
return;
- StorageWindow::addStore(item, item->getQuantity());
+ Net::getInventoryHandler()->moveItem(Net::InventoryHandler::INVENTORY,
+ item->getInvIndex(), item->getQuantity(),
+ Net::InventoryHandler::STORAGE);
}
}
}
@@ -271,6 +320,16 @@ void InventoryWindow::setSplitAllowed(bool allowed)
mSplitButton->setVisible(allowed);
}
+void InventoryWindow::close()
+{
+ if (this == inventoryWindow)
+ return;
+
+ Net::getInventoryHandler()->closeStorage(Net::InventoryHandler::STORAGE);
+
+ scheduleDelete();
+}
+
void InventoryWindow::updateWeight()
{
int total = player_node->getTotalWeight();
@@ -284,10 +343,13 @@ void InventoryWindow::updateWeight()
void InventoryWindow::slotsChanged(Inventory* inventory)
{
- const int usedSlots = player_node->getInventory()->getNumberOfSlotsUsed();
- const int maxSlots = player_node->getInventory()->getSize();
+ if (inventory == mInventory)
+ {
+ const int usedSlots = mInventory->getNumberOfSlotsUsed();
+ const int maxSlots = mInventory->getSize();
- mSlotsBar->setProgress((float) usedSlots / maxSlots);
+ mSlotsBar->setProgress((float) usedSlots / maxSlots);
- mSlotsBar->setText(strprintf("%d/%d", usedSlots, maxSlots));
+ mSlotsBar->setText(strprintf("%d/%d", usedSlots, maxSlots));
+ }
}
diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h
index cfea130f..406c24bf 100644
--- a/src/gui/inventorywindow.h
+++ b/src/gui/inventorywindow.h
@@ -24,7 +24,6 @@
#include "inventory.h"
-#include "gui/storagewindow.h"
#include "gui/widgets/window.h"
#include "net/inventoryhandler.h"
@@ -54,7 +53,7 @@ class InventoryWindow : public Window,
/**
* Constructor.
*/
- InventoryWindow();
+ InventoryWindow(Inventory *inventory, bool isMainInventory = false);
/**
* Destructor.
@@ -95,6 +94,12 @@ class InventoryWindow : public Window,
* Sets whether the split button should be shown.
*/
void setSplitAllowed(bool allowed);
+
+ /**
+ * Closes the Storage Window, as well as telling the server that the
+ * window has been closed.
+ */
+ void close();
/**
* Updates the weight bar.
@@ -103,24 +108,28 @@ class InventoryWindow : public Window,
void slotsChanged(Inventory* inventory);
+ /**
+ * Returns true if any instances exist.
+ */
+ static bool isStorageActive() { return instances.size() > 1; }
+
private:
+ typedef std::list<InventoryWindow*> WindowList;
+ static WindowList instances;
+
+ Inventory *mInventory;
ItemContainer *mItems;
- std::string mWeight;
- std::string mSlots;
+ std::string mWeight, mSlots;
+
+ gcn::Button *mUseButton, *mDropButton, *mSplitButton, *mOutfitButton,
+ *mStoreButton, *mRetrieveButton;
- gcn::Button *mUseButton;
- gcn::Button *mDropButton;
- gcn::Button *mSplitButton;
- gcn::Button *mOutfitButton;
- gcn::Label *mWeightLabel;
- gcn::Label *mSlotsLabel;
+ gcn::Label *mWeightLabel, *mSlotsLabel;
- ProgressBar *mWeightBar;
- ProgressBar *mSlotsBar;
+ ProgressBar *mWeightBar, *mSlotsBar;
bool mSplit;
- bool mItemDesc;
};
extern InventoryWindow *inventoryWindow;
diff --git a/src/gui/itemamount.cpp b/src/gui/itemamount.cpp
index 1dc5425f..f28bbed7 100644
--- a/src/gui/itemamount.cpp
+++ b/src/gui/itemamount.cpp
@@ -24,7 +24,6 @@
#include "item.h"
#include "keyboardconfig.h"
-#include "gui/storagewindow.h"
#include "gui/trade.h"
#include "gui/itempopup.h"
#include "gui/viewport.h"
@@ -54,10 +53,14 @@ void ItemAmountWindow::finish(Item *item, int amount, Usage usage)
Net::getInventoryHandler()->splitItem(item, amount);
break;
case StoreAdd:
- StorageWindow::addStore(item, amount);
+ Net::getInventoryHandler()->moveItem(Net::InventoryHandler::INVENTORY,
+ item->getInvIndex(), amount,
+ Net::InventoryHandler::STORAGE);
break;
case StoreRemove:
- StorageWindow::removeStore(item, amount);
+ Net::getInventoryHandler()->moveItem(Net::InventoryHandler::STORAGE,
+ item->getInvIndex(), amount,
+ Net::InventoryHandler::INVENTORY);
break;
default:
break;
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index 9052e9d2..8404fad1 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -33,7 +33,6 @@
#include "gui/chat.h"
#include "gui/inventorywindow.h"
-#include "gui/storagewindow.h"
#include "gui/itemamount.h"
#include "gui/widgets/browserbox.h"
@@ -386,7 +385,7 @@ void PopupMenu::showPopup(Window *parent, int x, int y, Item *item,
mBrowserBox->addRow(strprintf("@@split|%s@@", _("Split")));
}
- if (StorageWindow::isActive())
+ if (InventoryWindow::isStorageActive())
{
mBrowserBox->addRow(strprintf("@@store|%s@@", _("Store")));
}
diff --git a/src/gui/storagewindow.cpp b/src/gui/storagewindow.cpp
deleted file mode 100644
index c07653b1..00000000
--- a/src/gui/storagewindow.cpp
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * The Mana Client
- * Copyright (C) 2009 The Mana World Development Team
- * Copyright (C) 2009-2010 The Mana Developers
- *
- * This file is part of The Mana Client.
- *
- * This program 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.
- *
- * This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "gui/storagewindow.h"
-
-#include "inventory.h"
-#include "item.h"
-#include "localplayer.h"
-#include "units.h"
-#include "keyboardconfig.h"
-
-#include "gui/inventorywindow.h"
-#include "gui/itemamount.h"
-#include "gui/setup.h"
-#include "gui/theme.h"
-#include "gui/viewport.h"
-
-#include "gui/widgets/button.h"
-#include "gui/widgets/itemcontainer.h"
-#include "gui/widgets/label.h"
-#include "gui/widgets/layout.h"
-#include "gui/widgets/progressbar.h"
-#include "gui/widgets/scrollarea.h"
-
-#include "net/inventoryhandler.h"
-#include "net/net.h"
-
-#include "resources/iteminfo.h"
-
-#include "utils/gettext.h"
-#include "utils/stringutils.h"
-
-#include <guichan/font.hpp>
-#include <guichan/mouseinput.hpp>
-
-#include <string>
-
-StorageWindow::WindowList StorageWindow::instances;
-
-StorageWindow::StorageWindow(Inventory *inventory):
- Window(_("Storage")),
- mInventory(inventory),
- mItemDesc(false)
-{
- setWindowName("Storage");
- setResizable(true);
- setCloseButton(true);
- setupWindow->registerWindowForReset(this);
-
- // If you adjust these defaults, don't forget to adjust the trade window's.
- setDefaultSize(375, 300, ImageRect::CENTER);
-
- mStoreButton = new Button(_("Store"), "store", this);
- mRetrieveButton = new Button(_("Retrieve"), "retrieve", this);
-
- mCloseButton = new Button(_("Close"), "close", this);
-
- mItems = new ItemContainer(mInventory, true);
- mItems->addSelectionListener(this);
-
- gcn::ScrollArea *invenScroll = new ScrollArea(mItems);
- invenScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
-
- mUsedSlots = mInventory->getNumberOfSlotsUsed();
-
- mSlotsLabel = new Label(_("Slots:"));
-
- mSlotsBar = new ProgressBar(0.0f, 100, 20, Theme::PROG_INVY_SLOTS);
- mSlotsBar->setText(strprintf("%d/%d", mUsedSlots, mInventory->getSize()));
- mSlotsBar->setProgress((float) mUsedSlots / mInventory->getSize());
-
- setMinHeight(130);
- setMinWidth(200);
-
- place(0, 0, mSlotsLabel).setPadding(3);
- place(1, 0, mSlotsBar, 3);
- place(0, 1, invenScroll, 4, 4);
- place(0, 5, mStoreButton);
- place(1, 5, mRetrieveButton);
- place(3, 5, mCloseButton);
-
- Layout &layout = getLayout();
- layout.setRowHeight(0, mStoreButton->getHeight());
-
- loadWindowState();
-
- instances.push_back(this);
- setVisible(true);
-
- mInventory->addInventoyListener(this);
- slotsChanged(mInventory);
-}
-
-StorageWindow::~StorageWindow()
-{
- instances.remove(this);
-}
-
-void StorageWindow::action(const gcn::ActionEvent &event)
-{
- if (event.getId() == "store")
- {
- if (!inventoryWindow->isVisible()) return;
-
- Item *item = inventoryWindow->getSelectedItem();
-
- if (!item)
- return;
-
- ItemAmountWindow::showWindow(ItemAmountWindow::StoreAdd, this, item);
- }
- else if (event.getId() == "retrieve")
- {
- Item *item = mItems->getSelectedItem();
-
- if (!item)
- return;
-
- ItemAmountWindow::showWindow(ItemAmountWindow::StoreRemove, this,
- item);
- }
- else if (event.getId() == "close")
- {
- close();
- }
-}
-
-void StorageWindow::mouseClicked(gcn::MouseEvent &event)
-{
- Window::mouseClicked(event);
-
- if (event.getButton() == gcn::MouseEvent::RIGHT)
- {
- Item *item = mItems->getSelectedItem();
-
- if (!item)
- {
- mRetrieveButton->setEnabled(false);
- return;
- }
-
- mRetrieveButton->setEnabled(true);
-
- /* Convert relative to the window coordinates to absolute screen
- * coordinates.
- */
- const int mx = event.getX() + getX();
- const int my = event.getY() + getY();
- viewport->showPopup(this, mx, my, item, false);
- }
- if (event.getButton() == gcn::MouseEvent::LEFT)
- {
- if (keyboard.isKeyActive(keyboard.KEY_EMOTE))
- {
- Item *item = mItems->getSelectedItem();
-
- if(!item)
- return;
-
- removeStore(item, item->getQuantity());
- }
- }
-}
-
-Item *StorageWindow::getSelectedItem() const
-{
- return mItems->getSelectedItem();
-}
-
-void StorageWindow::slotsChanged(Inventory* inventory)
-{
- const int usedSlots = mInventory->getNumberOfSlotsUsed();
-
- mSlotsBar->setProgress((float) usedSlots / mInventory->getSize());
-
- mSlotsBar->setText(strprintf("%d/%d", usedSlots, mInventory->getSize()));
-}
-
-void StorageWindow::addStore(Item *item, int amount)
-{
- Net::getInventoryHandler()->moveItem(Net::InventoryHandler::INVENTORY,
- item->getInvIndex(), amount,
- Net::InventoryHandler::STORAGE);
-}
-
-void StorageWindow::removeStore(Item *item, int amount)
-{
- Net::getInventoryHandler()->moveItem(Net::InventoryHandler::STORAGE,
- item->getInvIndex(), amount,
- Net::InventoryHandler::INVENTORY);
-}
-
-void StorageWindow::close()
-{
- Net::getInventoryHandler()->closeStorage(Net::InventoryHandler::STORAGE);
-
- scheduleDelete();
-}
diff --git a/src/gui/storagewindow.h b/src/gui/storagewindow.h
deleted file mode 100644
index 8e09768d..00000000
--- a/src/gui/storagewindow.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * The Mana Client
- * Copyright (C) 2009 The Mana World Development Team
- * Copyright (C) 2009-2010 The Mana Developers
- *
- * This file is part of The Mana Client.
- *
- * This program 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.
- *
- * This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef STORAGEWINDOW_H
-#define STORAGEWINDOW_H
-
-#include "inventory.h"
-
-#include "gui/widgets/window.h"
-
-#include "net/inventoryhandler.h"
-#include "net/net.h"
-
-#include <guichan/actionlistener.hpp>
-#include <guichan/selectionlistener.hpp>
-
-class Item;
-class ItemContainer;
-class ProgressBar;
-class TextBox;
-
-/**
- * Storage dialog.
- *
- * \ingroup Interface
- */
-class StorageWindow : public Window, gcn::ActionListener,
- gcn::SelectionListener,
- public InventoryListener
-{
- public:
- /**
- * Constructor.
- */
- StorageWindow(Inventory *inventory);
-
- /**
- * Destructor.
- */
- ~StorageWindow();
-
- /**
- * Called when receiving actions from the widgets.
- */
- void action(const gcn::ActionEvent &event);
-
- /**
- * Returns the selected item.
- */
- Item* getSelectedItem() const;
-
- void mouseClicked(gcn::MouseEvent &event);
-
- /**
- * Closes the Storage Window, as well as telling the server that the
- * window has been closed.
- */
- void close();
-
- void slotsChanged(Inventory* inventory);
-
- /**
- * Add the specified ammount of the specified item to storage
- */
- static void addStore(Item* item, int amount);
-
- /**
- * Remove the specified ammount of the specified item from storage
- */
- static void removeStore(Item* item, int amount);
-
- /**
- * Returns true if any instances exist.
- */
- static bool isActive() { return instances.size() > 0; }
-
- private:
- typedef std::list<StorageWindow*> WindowList;
- static WindowList instances;
-
- Inventory *mInventory;
- ItemContainer *mItems;
-
- int mSlots;
- int mUsedSlots;
- gcn::Button *mStoreButton, *mRetrieveButton, *mCloseButton;
-
- gcn::Label *mSlotsLabel;
-
- ProgressBar *mSlotsBar;
-
- bool mItemDesc;
-};
-
-#endif // STORAGEWINDOW_H
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index d88b01f5..6c5f257d 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -44,7 +44,6 @@
#include "gui/ministatus.h"
#include "gui/skilldialog.h"
#include "gui/statuswindow.h"
-#include "gui/storagewindow.h"
#include "gui/theme.h"
#include "gui/userpalette.h"
diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp
index 60288ed3..1b191354 100644
--- a/src/net/ea/inventoryhandler.cpp
+++ b/src/net/ea/inventoryhandler.cpp
@@ -29,8 +29,6 @@
#include "localplayer.h"
#include "log.h"
-#include "gui/storagewindow.h"
-
#include "gui/widgets/chattab.h"
#include "net/messagein.h"
@@ -308,7 +306,7 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
mInventoryItems.clear();
if (!mStorageWindow)
- mStorageWindow = new StorageWindow(mStorage);
+ mStorageWindow = new InventoryWindow(mStorage);
}
break;
diff --git a/src/net/ea/inventoryhandler.h b/src/net/ea/inventoryhandler.h
index 2699e584..d08e4772 100644
--- a/src/net/ea/inventoryhandler.h
+++ b/src/net/ea/inventoryhandler.h
@@ -26,7 +26,7 @@
#include "inventory.h"
#include "localplayer.h"
-#include "gui/storagewindow.h"
+#include "gui/inventorywindow.h"
#include "net/inventoryhandler.h"
#include "net/net.h"
@@ -151,7 +151,7 @@ class InventoryHandler : public MessageHandler, public Net::InventoryHandler
EquipBackend mEquips;
InventoryItems mInventoryItems;
Inventory *mStorage;
- StorageWindow *mStorageWindow;
+ InventoryWindow *mStorageWindow;
};
} // namespace EAthena
diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp
index 89e55f92..6aeb5168 100644
--- a/src/net/ea/playerhandler.cpp
+++ b/src/net/ea/playerhandler.cpp
@@ -34,7 +34,6 @@
#include "gui/okdialog.h"
#include "gui/sell.h"
#include "gui/statuswindow.h"
-#include "gui/storagewindow.h"
#include "gui/viewport.h"
#include "gui/widgets/chattab.h"