summaryrefslogtreecommitdiff
path: root/src/gui/inventorywindow.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-06-23 12:21:55 +0300
committerAndrei Karas <akaras@inbox.ru>2013-06-23 17:36:25 +0300
commit4c57a567eec8b3df0b0009b5520d647cccb83338 (patch)
tree6677639ab67b1209532d20d0ebffa52e4227cdc8 /src/gui/inventorywindow.cpp
parenta685e41954590525f5a9f215dbd37a286ae2bd37 (diff)
downloadmanaplus-4c57a567eec8b3df0b0009b5520d647cccb83338.tar.gz
manaplus-4c57a567eec8b3df0b0009b5520d647cccb83338.tar.bz2
manaplus-4c57a567eec8b3df0b0009b5520d647cccb83338.tar.xz
manaplus-4c57a567eec8b3df0b0009b5520d647cccb83338.zip
Add support for protecting items.
Protected item cant be selled, traded, dropped, used. Protect/unprotect item can be from context menu.
Diffstat (limited to 'src/gui/inventorywindow.cpp')
-rw-r--r--src/gui/inventorywindow.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index f659b8693..553313289 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -360,6 +360,8 @@ void InventoryWindow::action(const gcn::ActionEvent &event)
}
else
{
+ if (PlayerInfo::isItemProtected(item->getId()))
+ return;
Net::getInventoryHandler()->useItem(item);
}
}
@@ -374,11 +376,16 @@ void InventoryWindow::action(const gcn::ActionEvent &event)
}
else
{
+ if (PlayerInfo::isItemProtected(item->getId()))
+ return;
Net::getInventoryHandler()->useItem(item);
}
}
else if (eventId == "drop")
{
+ if (PlayerInfo::isItemProtected(item->getId()))
+ return;
+
if (isStorageActive())
{
Net::getInventoryHandler()->moveItem2(Inventory::INVENTORY,
@@ -503,6 +510,8 @@ void InventoryWindow::mouseClicked(gcn::MouseEvent &event)
}
else if (mod2 && mInventory->isMainInventory())
{
+ if (PlayerInfo::isItemProtected(item->getId()))
+ return;
if (event.getButton() == gcn::MouseEvent::RIGHT)
{
ItemAmountWindow::showWindow(ItemAmountWindow::TradeAdd,
@@ -525,6 +534,8 @@ void InventoryWindow::mouseClicked(gcn::MouseEvent &event)
}
else if (tradeWindow && tradeWindow->isWindowVisible())
{
+ if (PlayerInfo::isItemProtected(item->getId()))
+ return;
ItemAmountWindow::showWindow(ItemAmountWindow::TradeAdd,
tradeWindow, item);
}
@@ -539,6 +550,8 @@ void InventoryWindow::mouseClicked(gcn::MouseEvent &event)
}
else
{
+ if (PlayerInfo::isItemProtected(item->getId()))
+ return;
Net::getInventoryHandler()->useItem(item);
}
}