summaryrefslogtreecommitdiffstats
path: root/src/Item.cpp
diff options
context:
space:
mode:
authorHownaer <franzi.moos@googlemail.com>2014-08-28 15:21:38 +0200
committerHownaer <franzi.moos@googlemail.com>2014-08-28 15:21:38 +0200
commitf1470fcf9f1dc907241a645614cdcd5547dc1dbd (patch)
treedc6aa1f14dc73273933b53a5faee39e94f5bc9c9 /src/Item.cpp
parentFixed crashes and use std::swap. (diff)
downloadcuberite-f1470fcf9f1dc907241a645614cdcd5547dc1dbd.tar
cuberite-f1470fcf9f1dc907241a645614cdcd5547dc1dbd.tar.gz
cuberite-f1470fcf9f1dc907241a645614cdcd5547dc1dbd.tar.bz2
cuberite-f1470fcf9f1dc907241a645614cdcd5547dc1dbd.tar.lz
cuberite-f1470fcf9f1dc907241a645614cdcd5547dc1dbd.tar.xz
cuberite-f1470fcf9f1dc907241a645614cdcd5547dc1dbd.tar.zst
cuberite-f1470fcf9f1dc907241a645614cdcd5547dc1dbd.zip
Diffstat (limited to '')
-rw-r--r--src/Item.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/Item.cpp b/src/Item.cpp
index 4d29318e6..ebdf99ca5 100644
--- a/src/Item.cpp
+++ b/src/Item.cpp
@@ -190,9 +190,16 @@ void cItem::FromJson(const Json::Value & a_Value)
-bool cItem::IsEnchantable(short a_ItemType)
+bool cItem::IsEnchantable(short a_ItemType, bool a_WithBook)
{
- if (ItemCategory::IsTool(a_ItemType) || ItemCategory::IsArmor(a_ItemType))
+ if (
+ ItemCategory::IsAxe(a_ItemType) ||
+ ItemCategory::IsSword(a_ItemType) ||
+ ItemCategory::IsShovel(a_ItemType) ||
+ ItemCategory::IsPickaxe(a_ItemType) ||
+ (a_WithBook && ItemCategory::IsHoe(a_ItemType)) ||
+ ItemCategory::IsArmor(a_ItemType)
+ )
{
return true;
}
@@ -201,12 +208,17 @@ bool cItem::IsEnchantable(short a_ItemType)
{
case E_ITEM_BOOK:
case E_ITEM_BOW:
- case E_ITEM_CARROT_ON_STICK:
case E_ITEM_FISHING_ROD:
- case E_ITEM_SHEARS:
{
return true;
}
+
+ case E_ITEM_CARROT_ON_STICK:
+ case E_ITEM_SHEARS:
+ case E_ITEM_FLINT_AND_STEEL:
+ {
+ return a_WithBook;
+ }
}
return false;