From 10d42a2452e19ca98506df4d85c0e8f37b3e8981 Mon Sep 17 00:00:00 2001 From: Lane Kolbly Date: Sun, 30 Jul 2017 12:53:21 -0500 Subject: Consolidated food effects into EatItem, added all fish type FoodInfos. (#3875) * Consolidated food effects into EatItem, added all fish types. * Changed type of NumFishInfos to satisfy clang. * Removed unused call for a_Item in EatItem --- src/Mobs/Wolf.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/Mobs/Wolf.cpp') 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(); -- cgit v1.2.3