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/Items/ItemHandler.cpp | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) (limited to 'src/Items/ItemHandler.cpp') diff --git a/src/Items/ItemHandler.cpp b/src/Items/ItemHandler.cpp index b430e83ef..c34b8b444 100644 --- a/src/Items/ItemHandler.cpp +++ b/src/Items/ItemHandler.cpp @@ -826,41 +826,17 @@ bool cItemHandler::GetPlacementBlockTypeMeta( -bool cItemHandler::GetEatEffect(cEntityEffect::eType & a_EffectType, int & a_EffectDurationTicks, short & a_EffectIntensity, float & a_Chance) -{ - return false; -} - - - - - bool cItemHandler::EatItem(cPlayer * a_Player, cItem * a_Item) { - UNUSED(a_Item); if (!a_Player->IsGameModeCreative()) { a_Player->GetInventory().RemoveOneEquippedItem(); } - FoodInfo Info = GetFoodInfo(); + FoodInfo Info = GetFoodInfo(a_Item); if ((Info.FoodLevel > 0) || (Info.Saturation > 0.f)) { - bool Success = a_Player->Feed(Info.FoodLevel, Info.Saturation); - - // Give effects - cEntityEffect::eType EffectType; - int EffectDurationTicks; - short EffectIntensity; - float Chance; - if (Success && GetEatEffect(EffectType, EffectDurationTicks, EffectIntensity, Chance)) - { - if (GetRandomProvider().RandBool(Chance)) - { - a_Player->AddEntityEffect(EffectType, EffectDurationTicks, EffectIntensity, Chance); - } - } - return Success; + return a_Player->Feed(Info.FoodLevel, Info.Saturation); } return false; } @@ -869,8 +845,9 @@ bool cItemHandler::EatItem(cPlayer * a_Player, cItem * a_Item) -cItemHandler::FoodInfo cItemHandler::GetFoodInfo() +cItemHandler::FoodInfo cItemHandler::GetFoodInfo(const cItem * a_Item) { + UNUSED(a_Item); return FoodInfo(0, 0); } -- cgit v1.2.3