diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-05-06 08:22:19 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-05-06 08:22:19 -0600 |
commit | 429e82f91487d48ecb5a1742ec6fb6987a2bc9bd (patch) | |
tree | d3789c7ef91680ba6a6a0eee56664ba3de690d94 /src/gui/inventorywindow.cpp | |
parent | 678c2316e34021bb16ac08eb48186f5570dc691b (diff) | |
download | mana-429e82f91487d48ecb5a1742ec6fb6987a2bc9bd.tar.gz mana-429e82f91487d48ecb5a1742ec6fb6987a2bc9bd.tar.bz2 mana-429e82f91487d48ecb5a1742ec6fb6987a2bc9bd.tar.xz mana-429e82f91487d48ecb5a1742ec6fb6987a2bc9bd.zip |
Remove more inventory handling support #ifdefs
This also fixes some minor bugs and centralizes some logic.
Diffstat (limited to 'src/gui/inventorywindow.cpp')
-rw-r--r-- | src/gui/inventorywindow.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index fa28bc34..8a18cd0d 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -37,6 +37,9 @@ #include "localplayer.h" #include "units.h" +#include "net/inventoryhandler.h" +#include "net/net.h" + #include "resources/iteminfo.h" #include "utils/gettext.h" @@ -75,9 +78,7 @@ InventoryWindow::InventoryWindow(int invSize): mUseButton = new Button(longestUseString, "use", this); mDropButton = new Button(_("Drop"), "drop", this); -#ifdef TMWSERV_SUPPORT mSplitButton = new Button(_("Split"), "split", this); -#endif mItems = new ItemContainer(player_node->getInventory()); mItems->addSelectionListener(this); @@ -101,9 +102,7 @@ InventoryWindow::InventoryWindow(int invSize): place(0, 1, invenScroll, 7).setPadding(3); place(0, 2, mUseButton); place(1, 2, mDropButton); -#ifdef TMWSERV_SUPPORT place(2, 2, mSplitButton); -#endif Layout &layout = getLayout(); layout.setRowHeight(1, Layout::AUTO_SET); @@ -217,7 +216,6 @@ void InventoryWindow::mouseClicked(gcn::MouseEvent &event) } } -#ifdef TMWSERV_SUPPORT void InventoryWindow::keyPressed(gcn::KeyEvent &event) { switch (event.getKey().getValue()) @@ -239,7 +237,6 @@ void InventoryWindow::keyReleased(gcn::KeyEvent &event) break; } } -#endif void InventoryWindow::valueChanged(const gcn::SelectionEvent &event) { @@ -273,14 +270,11 @@ void InventoryWindow::updateButtons() mUseButton->setEnabled(selectedItem != 0); mDropButton->setEnabled(selectedItem != 0); -#ifdef TMWSERV_SUPPORT - if (selectedItem && !selectedItem->isEquipment() && - selectedItem->getQuantity() > 1) + if (Net::getInventoryHandler()->canSplit(selectedItem)) { mSplitButton->setEnabled(true); } else { mSplitButton->setEnabled(false); } -#endif } |