From 4c57a567eec8b3df0b0009b5520d647cccb83338 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 23 Jun 2013 12:21:55 +0300 Subject: Add support for protecting items. Protected item cant be selled, traded, dropped, used. Protect/unprotect item can be from context menu. --- src/dropshortcut.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src/dropshortcut.cpp') diff --git a/src/dropshortcut.cpp b/src/dropshortcut.cpp index d0e49ab5f..87e992b78 100644 --- a/src/dropshortcut.cpp +++ b/src/dropshortcut.cpp @@ -103,6 +103,8 @@ void DropShortcut::dropFirst() const const int itemId = getItem(0); const unsigned char itemColor = getItemColor(0); + if (PlayerInfo::isItemProtected(itemId)) + return; if (itemId > 0) { @@ -161,10 +163,14 @@ bool DropShortcut::dropItem(const int cnt) unsigned char itemColor = 1; while (mLastDropIndex < DROP_SHORTCUT_ITEMS && itemId < 1) { - itemId = getItem(mLastDropIndex); - itemColor = getItemColor(mLastDropIndex); + if (!PlayerInfo::isItemProtected(itemId)) + { + itemId = getItem(mLastDropIndex); + itemColor = getItemColor(mLastDropIndex); + } mLastDropIndex ++; } + if (itemId > 0) { const Item *const item = inv->findItem(itemId, itemColor); @@ -181,8 +187,11 @@ bool DropShortcut::dropItem(const int cnt) { while (mLastDropIndex < DROP_SHORTCUT_ITEMS && itemId < 1) { - itemId = getItem(mLastDropIndex); - itemColor = getItemColor(mLastDropIndex); + if (!PlayerInfo::isItemProtected(itemId)) + { + itemId = getItem(mLastDropIndex); + itemColor = getItemColor(mLastDropIndex); + } mLastDropIndex++; } if (itemId > 0) -- cgit v1.2.3-60-g2f50