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
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user