1
0

Fixed food handler for mushroom soup - proper food level and saturation are applied and the player receives a wooden bowl back after nomming

This commit is contained in:
James Ravenscroft 2013-08-08 16:32:14 +01:00
parent cc920ea929
commit 9f7db50de0
3 changed files with 9 additions and 0 deletions

View File

@ -50,6 +50,7 @@ public:
case E_ITEM_ROTTEN_FLESH: return FoodInfo(4, 0.8, 80);
case E_ITEM_SPIDER_EYE: return FoodInfo(2, 3.2, 100);
case E_ITEM_STEAK: return FoodInfo(8, 12.8);
case E_ITEM_MUSHROOM_SOUP: return FoodInfo(6, 7.2);
}
LOGWARNING("%s: Unknown food item (%d), returning zero nutrition", __FUNCTION__, m_ItemType);
return FoodInfo(0, 0.f);

View File

@ -181,6 +181,7 @@ cItemHandler *cItemHandler::CreateItemHandler(int a_ItemType)
case E_ITEM_RED_APPLE:
case E_ITEM_GOLDEN_APPLE:
case E_ITEM_ROTTEN_FLESH:
case E_ITEM_MUSHROOM_SOUP:
case E_ITEM_SPIDER_EYE:
{
return new cItemFoodHandler(a_ItemType);

View File

@ -400,7 +400,14 @@ void cPlayer::FinishEating(void)
return;
}
ItemHandler->OnFoodEaten(m_World, this, &Item);
GetInventory().RemoveOneEquippedItem();
//if the food is mushroom soup, return a bowl to the inventory
if( Item.m_ItemType == E_ITEM_MUSHROOM_SOUP ) {
cItem emptyBowl(E_ITEM_BOWL, 1, 0, "");
GetInventory().AddItem(emptyBowl, true, true);
}
}