summaryrefslogtreecommitdiffstats
path: root/src/Mobs
diff options
context:
space:
mode:
authorjfhumann <j.f.humann@gmail.com>2014-04-18 21:09:44 +0200
committerjfhumann <j.f.humann@gmail.com>2014-04-18 21:09:44 +0200
commit013da806ec20b62a742aded9a9d2b8131193f30d (patch)
treebfe1f833f93cd4a57619fa149f5f9075a28862e2 /src/Mobs
parentProtoProxy: Added 1.7.9 compatibility. (diff)
downloadcuberite-013da806ec20b62a742aded9a9d2b8131193f30d.tar
cuberite-013da806ec20b62a742aded9a9d2b8131193f30d.tar.gz
cuberite-013da806ec20b62a742aded9a9d2b8131193f30d.tar.bz2
cuberite-013da806ec20b62a742aded9a9d2b8131193f30d.tar.lz
cuberite-013da806ec20b62a742aded9a9d2b8131193f30d.tar.xz
cuberite-013da806ec20b62a742aded9a9d2b8131193f30d.tar.zst
cuberite-013da806ec20b62a742aded9a9d2b8131193f30d.zip
Diffstat (limited to 'src/Mobs')
-rw-r--r--src/Mobs/Sheep.cpp7
-rw-r--r--src/Mobs/Wolf.h2
2 files changed, 5 insertions, 4 deletions
diff --git a/src/Mobs/Sheep.cpp b/src/Mobs/Sheep.cpp
index c64360153..b3d4d93c1 100644
--- a/src/Mobs/Sheep.cpp
+++ b/src/Mobs/Sheep.cpp
@@ -36,7 +36,8 @@ void cSheep::GetDrops(cItems & a_Drops, cEntity * a_Killer)
void cSheep::OnRightClicked(cPlayer & a_Player)
{
- if ((a_Player.GetEquippedItem().m_ItemType == E_ITEM_SHEARS) && (!m_IsSheared))
+ const cItem & EquippedItem = a_Player.GetEquippedItem();
+ if ((EquippedItem.m_ItemType == E_ITEM_SHEARS) && (!m_IsSheared))
{
m_IsSheared = true;
m_World->BroadcastEntityMetadata(*this);
@@ -51,9 +52,9 @@ void cSheep::OnRightClicked(cPlayer & a_Player)
Drops.push_back(cItem(E_BLOCK_WOOL, NumDrops, m_WoolColor));
m_World->SpawnItemPickups(Drops, GetPosX(), GetPosY(), GetPosZ(), 10);
}
- if ((a_Player.GetEquippedItem().m_ItemType == E_ITEM_DYE) && (m_WoolColor != 15 - a_Player.GetEquippedItem().m_ItemDamage))
+ else if ((EquippedItem.m_ItemType == E_ITEM_DYE) && (m_WoolColor != 15 - EquippedItem.m_ItemDamage))
{
- m_WoolColor = 15 - a_Player.GetEquippedItem().m_ItemDamage;
+ m_WoolColor = 15 - EquippedItem.m_ItemDamage;
if (!a_Player.IsGameModeCreative())
{
a_Player.GetInventory().RemoveOneEquippedItem();
diff --git a/src/Mobs/Wolf.h b/src/Mobs/Wolf.h
index 9e5ad03c7..5925373e1 100644
--- a/src/Mobs/Wolf.h
+++ b/src/Mobs/Wolf.h
@@ -37,7 +37,7 @@ public:
void SetIsTame (bool a_IsTame) { m_IsTame = a_IsTame; }
void SetIsBegging (bool a_IsBegging) { m_IsBegging = a_IsBegging; }
void SetIsAngry (bool a_IsAngry) { m_IsAngry = a_IsAngry; }
- void SetOwner (AString a_NewOwner) { m_OwnerName = a_NewOwner; }
+ void SetOwner (const AString & a_NewOwner) { m_OwnerName = a_NewOwner; }
void SetCollarColor(int a_CollarColor) { m_CollarColor = a_CollarColor; }
protected: