summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/inventorywindow.cpp14
-rw-r--r--src/gui/inventorywindow.h8
-rw-r--r--src/gui/itemamount.cpp4
-rw-r--r--src/gui/popupmenu.cpp9
4 files changed, 6 insertions, 29 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
}
diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h
index a39ea34b..1c8db89c 100644
--- a/src/gui/inventorywindow.h
+++ b/src/gui/inventorywindow.h
@@ -49,11 +49,7 @@ class InventoryWindow : public Window,
/**
* Constructor.
*/
-#ifdef TMWSERV_SUPPORT
InventoryWindow(int invSize = (INVENTORY_SIZE));
-#else
- InventoryWindow(int invSize = (INVENTORY_SIZE - 2));
-#endif
/**
* Destructor.
@@ -80,7 +76,6 @@ class InventoryWindow : public Window,
*/
void mouseClicked(gcn::MouseEvent &event);
-#ifdef TMWSERV_SUPPORT
/**
* Handles the key presses.
*/
@@ -90,7 +85,6 @@ class InventoryWindow : public Window,
* Handles the key releases.
*/
void keyReleased(gcn::KeyEvent &event);
-#endif
/**
* Updates labels to currently selected item.
@@ -109,9 +103,7 @@ class InventoryWindow : public Window,
int mMaxWeight;
gcn::Button *mUseButton;
gcn::Button *mDropButton;
-#ifdef TMWSERV_SUPPORT
gcn::Button *mSplitButton;
-#endif
gcn::Label *mWeightLabel;
gcn::Label *mSlotsLabel;
diff --git a/src/gui/itemamount.cpp b/src/gui/itemamount.cpp
index 46d12ee5..1bbd6fdd 100644
--- a/src/gui/itemamount.cpp
+++ b/src/gui/itemamount.cpp
@@ -21,9 +21,7 @@
#include "gui/itemamount.h"
-#ifdef EATHENA_SUPPORT
#include "gui/storagewindow.h"
-#endif
#include "gui/trade.h"
#include "gui/widgets/button.h"
@@ -155,11 +153,9 @@ void ItemAmountWindow::action(const gcn::ActionEvent &event)
case ItemDrop:
player_node->dropItem(mItem, amount);
break;
-#ifdef TMWSERV_SUPPORT
case ItemSplit:
player_node->splitItem(mItem, amount);
break;
-#endif
case StoreAdd:
storageWindow->addStore(mItem, amount);
break;
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index c46f673c..6f2f9be4 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -38,6 +38,7 @@
#include "playerrelations.h"
#include "net/adminhandler.h"
+#include "net/inventoryhandler.h"
#include "net/net.h"
#include "resources/itemdb.h"
@@ -259,14 +260,10 @@ void PopupMenu::handleLink(const std::string &link)
assert(mItem);
if (mItem->isEquipment())
{
-#ifdef TMWSERV_SUPPORT
- player_node->equipItem(mItem);
-#else
if (mItem->isEquipped())
player_node->unequipItem(mItem);
else
player_node->equipItem(mItem);
-#endif
}
else
{
@@ -357,12 +354,10 @@ void PopupMenu::showPopup(int x, int y, Item *item, bool isInventory)
mBrowserBox->addRow(_("@@drop|Drop@@"));
-#ifdef TMWSERV_SUPPORT
- if (!item->isEquipment())
+ if (Net::getInventoryHandler()->canSplit(item))
{
mBrowserBox->addRow(_("@@split|Split@@"));
}
-#endif
if (player_node->getInStorage())
{