summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Wolf.cpp
diff options
context:
space:
mode:
authorLane Kolbly <lane@rscheme.org>2017-07-30 19:53:21 +0200
committerworktycho <work.tycho@gmail.com>2017-07-30 19:53:21 +0200
commit10d42a2452e19ca98506df4d85c0e8f37b3e8981 (patch)
tree84ab60be36919dac3b24e7384bfd533349a9d177 /src/Mobs/Wolf.cpp
parentcParsedNBT: Improved error reporting (#3876) (diff)
downloadcuberite-10d42a2452e19ca98506df4d85c0e8f37b3e8981.tar
cuberite-10d42a2452e19ca98506df4d85c0e8f37b3e8981.tar.gz
cuberite-10d42a2452e19ca98506df4d85c0e8f37b3e8981.tar.bz2
cuberite-10d42a2452e19ca98506df4d85c0e8f37b3e8981.tar.lz
cuberite-10d42a2452e19ca98506df4d85c0e8f37b3e8981.tar.xz
cuberite-10d42a2452e19ca98506df4d85c0e8f37b3e8981.tar.zst
cuberite-10d42a2452e19ca98506df4d85c0e8f37b3e8981.zip
Diffstat (limited to '')
-rw-r--r--src/Mobs/Wolf.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/Mobs/Wolf.cpp b/src/Mobs/Wolf.cpp
index 560a6b2fa..33a9b31ee 100644
--- a/src/Mobs/Wolf.cpp
+++ b/src/Mobs/Wolf.cpp
@@ -169,10 +169,13 @@ void cWolf::ReceiveNearbyFightInfo(AString a_PlayerID, cPawn * a_Opponent, bool
void cWolf::OnRightClicked(cPlayer & a_Player)
{
+ const cItem & EquippedItem = a_Player.GetEquippedItem();
+ const int EquippedItemType = EquippedItem.m_ItemType;
+
if (!IsTame() && !IsAngry())
{
// If the player is holding a bone, try to tame the wolf:
- if (a_Player.GetEquippedItem().m_ItemType == E_ITEM_BONE)
+ if (EquippedItemType == E_ITEM_BONE)
{
if (!a_Player.IsGameModeCreative())
{
@@ -199,7 +202,7 @@ void cWolf::OnRightClicked(cPlayer & a_Player)
else if (IsTame())
{
// Feed the wolf, restoring its health, or dye its collar:
- switch (a_Player.GetEquippedItem().m_ItemType)
+ switch (EquippedItemType)
{
case E_ITEM_RAW_BEEF:
case E_ITEM_STEAK:
@@ -211,7 +214,7 @@ void cWolf::OnRightClicked(cPlayer & a_Player)
{
if (m_Health < m_MaxHealth)
{
- Heal(ItemHandler(a_Player.GetEquippedItem().m_ItemType)->GetFoodInfo().FoodLevel);
+ Heal(ItemHandler(EquippedItemType)->GetFoodInfo(&EquippedItem).FoodLevel);
if (!a_Player.IsGameModeCreative())
{
a_Player.GetInventory().RemoveOneEquippedItem();
@@ -223,7 +226,7 @@ void cWolf::OnRightClicked(cPlayer & a_Player)
{
if (a_Player.GetUUID() == m_OwnerUUID) // Is the player the owner of the dog?
{
- SetCollarColor(a_Player.GetEquippedItem().m_ItemDamage);
+ SetCollarColor(EquippedItem.m_ItemDamage);
if (!a_Player.IsGameModeCreative())
{
a_Player.GetInventory().RemoveOneEquippedItem();