summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Pioch <lukas@zgow.de>2017-08-24 13:26:23 +0200
committerLukas Pioch <lukas@zgow.de>2017-08-24 14:36:29 +0200
commitb55e5f5ad142404a5e376bb65f963acf1a4f8ff3 (patch)
tree2bdba95efede489ed35d24ff434ec11d6a5c1980
parentUse target_compile_options instead of variables to add -fomit-frame-pointer to mbedtls (diff)
downloadcuberite-b55e5f5ad142404a5e376bb65f963acf1a4f8ff3.tar
cuberite-b55e5f5ad142404a5e376bb65f963acf1a4f8ff3.tar.gz
cuberite-b55e5f5ad142404a5e376bb65f963acf1a4f8ff3.tar.bz2
cuberite-b55e5f5ad142404a5e376bb65f963acf1a4f8ff3.tar.lz
cuberite-b55e5f5ad142404a5e376bb65f963acf1a4f8ff3.tar.xz
cuberite-b55e5f5ad142404a5e376bb65f963acf1a4f8ff3.tar.zst
cuberite-b55e5f5ad142404a5e376bb65f963acf1a4f8ff3.zip
Diffstat (limited to '')
-rw-r--r--src/Entities/LeashKnot.cpp2
-rw-r--r--src/Mobs/Monster.cpp12
-rw-r--r--src/Mobs/Monster.h2
3 files changed, 8 insertions, 8 deletions
diff --git a/src/Entities/LeashKnot.cpp b/src/Entities/LeashKnot.cpp
index 52bb1b4b3..a86dc9d53 100644
--- a/src/Entities/LeashKnot.cpp
+++ b/src/Entities/LeashKnot.cpp
@@ -83,7 +83,7 @@ void cLeashKnot::TiePlayersLeashedMobs(cPlayer & a_Player, bool a_ShouldBroadCas
// All conditions met, unleash from player and leash to fence
PotentialLeashed->Unleash(false, false);
- PotentialLeashed->LeashTo(m_Knot, m_ShouldBroadcast);
+ PotentialLeashed->LeashTo(*m_Knot, m_ShouldBroadcast);
return false;
}
} LookForLeashedsCallback(this, &a_Player, a_ShouldBroadCast);
diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp
index d1c2413c3..26db4b3dd 100644
--- a/src/Mobs/Monster.cpp
+++ b/src/Mobs/Monster.cpp
@@ -431,7 +431,7 @@ void cMonster::CalcLeashActions()
auto LeashKnot = cLeashKnot::FindKnotAtPos(*m_World, { FloorC(m_LeashToPos->x), FloorC(m_LeashToPos->y), FloorC(m_LeashToPos->z) });
if (LeashKnot != nullptr)
{
- LeashTo(LeashKnot);
+ LeashTo(*LeashKnot);
SetLeashToPos(nullptr);
}
}
@@ -688,7 +688,7 @@ void cMonster::OnRightClicked(cPlayer & a_Player)
{
a_Player.GetInventory().RemoveOneEquippedItem();
}
- LeashTo(&a_Player);
+ LeashTo(a_Player);
}
}
@@ -1407,7 +1407,7 @@ cMonster::eFamily cMonster::GetMobFamily(void) const
-void cMonster::LeashTo(cEntity * a_Entity, bool a_ShouldBroadcast)
+void cMonster::LeashTo(cEntity & a_Entity, bool a_ShouldBroadcast)
{
// Do nothing if already leashed
if (m_LeashedTo != nullptr)
@@ -1415,13 +1415,13 @@ void cMonster::LeashTo(cEntity * a_Entity, bool a_ShouldBroadcast)
return;
}
- m_LeashedTo = a_Entity;
+ m_LeashedTo = &a_Entity;
- a_Entity->AddLeashedMob(this);
+ a_Entity.AddLeashedMob(this);
if (a_ShouldBroadcast)
{
- m_World->BroadcastLeashEntity(*this, *a_Entity);
+ m_World->BroadcastLeashEntity(*this, a_Entity);
}
m_IsLeashActionJustDone = true;
diff --git a/src/Mobs/Monster.h b/src/Mobs/Monster.h
index d98706f8b..1f6bd6011 100644
--- a/src/Mobs/Monster.h
+++ b/src/Mobs/Monster.h
@@ -84,7 +84,7 @@ public:
bool IsLeashed() const { return (m_LeashedTo != nullptr); }
/** Leash the monster to an entity. */
- void LeashTo(cEntity * a_Entity, bool a_ShouldBroadcast = true);
+ void LeashTo(cEntity & a_Entity, bool a_ShouldBroadcast = true);
/** Unleash the monster. Overload for the Unleash(bool, bool) function for plugins */
void Unleash(bool a_ShouldDropLeashPickup);