From 396739cc0faf01a099acbe669c5a9def98d3aaae Mon Sep 17 00:00:00 2001 From: Howaner Date: Wed, 23 Jul 2014 16:32:09 +0200 Subject: Fix item durability. Fixes #1181 --- src/Items/ItemSword.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/Items/ItemSword.h') diff --git a/src/Items/ItemSword.h b/src/Items/ItemSword.h index 44feb2d83..8fd70bd7b 100644 --- a/src/Items/ItemSword.h +++ b/src/Items/ItemSword.h @@ -12,18 +12,20 @@ class cItemSwordHandler : public cItemHandler { + typedef cItemHandler super; public: cItemSwordHandler(int a_ItemType) : cItemHandler(a_ItemType) { - } - + + virtual bool CanHarvestBlock(BLOCKTYPE a_BlockType) override { return (a_BlockType == E_BLOCK_COBWEB); } + virtual bool CanRepairWithRawMaterial(short a_ItemType) override { switch (m_ItemType) @@ -36,6 +38,17 @@ public: } return false; } + + + virtual short GetDurabilityLostWithThatAction(eDurabilityLostAction a_Action) override + { + switch (a_Action) + { + case dlaAttackEntity: return 1; + case dlaBreakBlock: return 2; + } + return 0; + } } ; -- cgit v1.2.3 From 4de8f5ca2926068eb855ba19c35de2a63ddebf28 Mon Sep 17 00:00:00 2001 From: Howaner Date: Sat, 26 Jul 2014 13:26:14 +0200 Subject: Rename function. --- src/Items/ItemSword.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Items/ItemSword.h') diff --git a/src/Items/ItemSword.h b/src/Items/ItemSword.h index 1a17023ef..b90965535 100644 --- a/src/Items/ItemSword.h +++ b/src/Items/ItemSword.h @@ -44,7 +44,7 @@ public: } - virtual short GetDurabilityLostWithThatAction(eDurabilityLostAction a_Action) override + virtual short GetDurabilityLossByAction(eDurabilityLostAction a_Action) override { switch (a_Action) { -- cgit v1.2.3