summaryrefslogtreecommitdiff
path: root/src/gui/windows/inventorywindow.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-10-04 15:19:53 +0300
committerAndrei Karas <akaras@inbox.ru>2013-10-04 15:19:53 +0300
commita553b3cda91aa095d88e22abcaa81701c2894334 (patch)
treecb44d56a66896fdbf4eaf9673901ee9cf3a60a73 /src/gui/windows/inventorywindow.cpp
parent343809fe458a08bf96fe4f537db2d81d7523632e (diff)
downloadplus-a553b3cda91aa095d88e22abcaa81701c2894334.tar.gz
plus-a553b3cda91aa095d88e22abcaa81701c2894334.tar.bz2
plus-a553b3cda91aa095d88e22abcaa81701c2894334.tar.xz
plus-a553b3cda91aa095d88e22abcaa81701c2894334.zip
move equip/unequip/use calls into playerinfo.
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);
}
}
}