summaryrefslogtreecommitdiff
path: root/src/gui/windows/inventorywindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/windows/inventorywindow.cpp')
-rw-r--r--src/gui/windows/inventorywindow.cpp34
1 files changed, 5 insertions, 29 deletions
diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp
index 75bd90edc..99d4d4954 100644
--- a/src/gui/windows/inventorywindow.cpp
+++ b/src/gui/windows/inventorywindow.cpp
@@ -358,35 +358,11 @@ void InventoryWindow::action(const gcn::ActionEvent &event)
if (eventId == "use")
{
- if (item->isEquipment())
- {
- if (item->isEquipped())
- Net::getInventoryHandler()->unequipItem(item);
- else
- Net::getInventoryHandler()->equipItem(item);
- }
- else
- {
- if (PlayerInfo::isItemProtected(item->getId()))
- return;
- Net::getInventoryHandler()->useItem(item);
- }
+ PlayerInfo::useEquipItem(item);
}
if (eventId == "equip")
{
- if (!item->isEquipment())
- {
- if (item->isEquipped())
- Net::getInventoryHandler()->unequipItem(item);
- else
- Net::getInventoryHandler()->equipItem(item);
- }
- else
- {
- if (PlayerInfo::isItemProtected(item->getId()))
- return;
- Net::getInventoryHandler()->useItem(item);
- }
+ PlayerInfo::useEquipItem2(item);
}
else if (eventId == "drop")
{
@@ -551,15 +527,15 @@ void InventoryWindow::mouseClicked(gcn::MouseEvent &event)
if (item->isEquipment())
{
if (item->isEquipped())
- Net::getInventoryHandler()->unequipItem(item);
+ PlayerInfo::unequipItem(item);
else
- Net::getInventoryHandler()->equipItem(item);
+ PlayerInfo::equipItem(item);
}
else
{
if (PlayerInfo::isItemProtected(item->getId()))
return;
- Net::getInventoryHandler()->useItem(item);
+ PlayerInfo::useItem(item);
}
}
}