summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Wolf.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-02-20 22:14:16 +0100
committerMattes D <github@xoft.cz>2014-02-20 22:14:16 +0100
commit6c9779630e1c1101198f2e5c2d885c3bdf5163cc (patch)
tree34d86fc72a8dcc1531d17cdf7970920e3cbbf199 /src/Mobs/Wolf.cpp
parentMerge pull request #702 from TheJumper/master (diff)
parentBad UTF-8 o.O (diff)
downloadcuberite-6c9779630e1c1101198f2e5c2d885c3bdf5163cc.tar
cuberite-6c9779630e1c1101198f2e5c2d885c3bdf5163cc.tar.gz
cuberite-6c9779630e1c1101198f2e5c2d885c3bdf5163cc.tar.bz2
cuberite-6c9779630e1c1101198f2e5c2d885c3bdf5163cc.tar.lz
cuberite-6c9779630e1c1101198f2e5c2d885c3bdf5163cc.tar.xz
cuberite-6c9779630e1c1101198f2e5c2d885c3bdf5163cc.tar.zst
cuberite-6c9779630e1c1101198f2e5c2d885c3bdf5163cc.zip
Diffstat (limited to 'src/Mobs/Wolf.cpp')
-rw-r--r--src/Mobs/Wolf.cpp44
1 files changed, 34 insertions, 10 deletions
diff --git a/src/Mobs/Wolf.cpp b/src/Mobs/Wolf.cpp
index 2736c3dd1..0d3619166 100644
--- a/src/Mobs/Wolf.cpp
+++ b/src/Mobs/Wolf.cpp
@@ -4,6 +4,7 @@
#include "Wolf.h"
#include "../World.h"
#include "../Entities/Player.h"
+#include "../Items/ItemHandler.h"
@@ -86,23 +87,44 @@ void cWolf::OnRightClicked(cPlayer & a_Player)
}
else if (IsTame())
{
- if (a_Player.GetName() == m_OwnerName) // Is the player the owner of the dog?
+ switch (a_Player.GetEquippedItem().m_ItemType)
{
- if (a_Player.GetEquippedItem().m_ItemType == E_ITEM_DYE)
+ case E_ITEM_RAW_BEEF:
+ case E_ITEM_STEAK:
+ case E_ITEM_RAW_PORKCHOP:
+ case E_ITEM_COOKED_PORKCHOP:
+ case E_ITEM_RAW_CHICKEN:
+ case E_ITEM_COOKED_CHICKEN:
+ case E_ITEM_ROTTEN_FLESH:
{
- SetCollarColor(15 - a_Player.GetEquippedItem().m_ItemDamage);
- if (!a_Player.IsGameModeCreative())
+ if (m_Health < m_MaxHealth)
{
- a_Player.GetInventory().RemoveOneEquippedItem();
+ Heal(ItemHandler(a_Player.GetEquippedItem().m_ItemType)->GetFoodInfo().FoodLevel);
+ if (!a_Player.IsGameModeCreative())
+ {
+ a_Player.GetInventory().RemoveOneEquippedItem();
+ }
}
- }
- else if (IsSitting())
+ break;
+ }
+ case E_ITEM_DYE:
{
- SetIsSitting(false);
+ if (a_Player.GetName() == m_OwnerName) // Is the player the owner of the dog?
+ {
+ SetCollarColor(15 - a_Player.GetEquippedItem().m_ItemDamage);
+ if (!a_Player.IsGameModeCreative())
+ {
+ a_Player.GetInventory().RemoveOneEquippedItem();
+ }
+ }
+ break;
}
- else
+ default:
{
- SetIsSitting(true);
+ if (a_Player.GetName() == m_OwnerName) // Is the player the owner of the dog?
+ {
+ SetIsSitting(!IsSitting());
+ }
}
}
}
@@ -136,6 +158,8 @@ void cWolf::Tick(float a_Dt, cChunk & a_Chunk)
case E_ITEM_RAW_CHICKEN:
case E_ITEM_COOKED_CHICKEN:
case E_ITEM_ROTTEN_FLESH:
+ case E_ITEM_RAW_PORKCHOP:
+ case E_ITEM_COOKED_PORKCHOP:
{
if (!IsBegging())
{