diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/popups/popupmenu.cpp | 16 | ||||
-rw-r--r-- | src/gui/windows/equipmentwindow.cpp | 6 | ||||
-rw-r--r-- | src/gui/windows/inventorywindow.cpp | 34 | ||||
-rw-r--r-- | src/gui/windows/outfitwindow.cpp | 4 |
4 files changed, 11 insertions, 49 deletions
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 015067a6f..459925bd0 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -1012,21 +1012,7 @@ void PopupMenu::handleLink(const std::string &link, if (inv) { const Item *const item = inv->findItem(mItemId, mItemColor); - if (item) - { - if (item->isEquipment()) - { - if (item->isEquipped()) - Net::getInventoryHandler()->unequipItem(item); - else - Net::getInventoryHandler()->equipItem(item); - } - else - { - if (!PlayerInfo::isItemProtected(item->getId())) - Net::getInventoryHandler()->useItem(item); - } - } + PlayerInfo::useEquipItem(item); } } else if (mItemId < SKILL_MIN_ID && spellManager) diff --git a/src/gui/windows/equipmentwindow.cpp b/src/gui/windows/equipmentwindow.cpp index 8cfb3b28e..5f214cebe 100644 --- a/src/gui/windows/equipmentwindow.cpp +++ b/src/gui/windows/equipmentwindow.cpp @@ -257,7 +257,7 @@ void EquipmentWindow::action(const gcn::ActionEvent &event) if (event.getId() == "unequip" && mSelected > -1) { const Item *const item = mEquipment->getEquipment(mSelected); - Net::getInventoryHandler()->unequipItem(item); + PlayerInfo::unequipItem(item); setSelected(-1); } } @@ -377,7 +377,7 @@ void EquipmentWindow::mouseReleased(gcn::MouseEvent &mouseEvent) if (item->isEquipment()) { if (!item->isEquipped()) - Net::getInventoryHandler()->equipItem(item); + PlayerInfo::equipItem(item); } } else if (dragDrop.getSource() == DRAGDROP_SOURCE_EQUIPMENT) @@ -401,7 +401,7 @@ void EquipmentWindow::mouseReleased(gcn::MouseEvent &mouseEvent) } if (item->isEquipped()) - Net::getInventoryHandler()->unequipItem(item); + PlayerInfo::unequipItem(item); } } dragDrop.clear(); 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); } } } diff --git a/src/gui/windows/outfitwindow.cpp b/src/gui/windows/outfitwindow.cpp index 38a837872..73acf475a 100644 --- a/src/gui/windows/outfitwindow.cpp +++ b/src/gui/windows/outfitwindow.cpp @@ -279,7 +279,7 @@ void OutfitWindow::wearOutfit(const int outfit, const bool unwearEmpty, { if (item->isEquipment()) { - Net::getInventoryHandler()->equipItem(item); + PlayerInfo::equipItem(item); isEmpty = false; } } @@ -522,7 +522,7 @@ void OutfitWindow::unequipNotInOutfit(const int outfit) const } } if (!found) - Net::getInventoryHandler()->unequipItem(item); + PlayerInfo::unequipItem(item); } } } |