diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-06-23 12:21:55 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-06-23 17:36:25 +0300 |
commit | 4c57a567eec8b3df0b0009b5520d647cccb83338 (patch) | |
tree | 6677639ab67b1209532d20d0ebffa52e4227cdc8 /src/dropshortcut.cpp | |
parent | a685e41954590525f5a9f215dbd37a286ae2bd37 (diff) | |
download | mv-4c57a567eec8b3df0b0009b5520d647cccb83338.tar.gz mv-4c57a567eec8b3df0b0009b5520d647cccb83338.tar.bz2 mv-4c57a567eec8b3df0b0009b5520d647cccb83338.tar.xz mv-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/dropshortcut.cpp')
-rw-r--r-- | src/dropshortcut.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
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) |