summaryrefslogtreecommitdiffstats
path: root/src/Mobs
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2016-01-16 15:58:49 +0100
committerLogicParrot <LogicParrot@users.noreply.github.com>2016-01-16 15:58:49 +0100
commitdc33276dda5beacf9470d6060f72730118ba550d (patch)
tree6ebcb9d63146b2626311220b69b0c311e2a74c94 /src/Mobs
parentMerge pull request #2875 from LogicParrot/fallDamage (diff)
parentFix crash when tamed wolf is hit by arrows (diff)
downloadcuberite-dc33276dda5beacf9470d6060f72730118ba550d.tar
cuberite-dc33276dda5beacf9470d6060f72730118ba550d.tar.gz
cuberite-dc33276dda5beacf9470d6060f72730118ba550d.tar.bz2
cuberite-dc33276dda5beacf9470d6060f72730118ba550d.tar.lz
cuberite-dc33276dda5beacf9470d6060f72730118ba550d.tar.xz
cuberite-dc33276dda5beacf9470d6060f72730118ba550d.tar.zst
cuberite-dc33276dda5beacf9470d6060f72730118ba550d.zip
Diffstat (limited to 'src/Mobs')
-rw-r--r--src/Mobs/Wolf.cpp6
-rw-r--r--src/Mobs/Wolf.h2
2 files changed, 6 insertions, 2 deletions
diff --git a/src/Mobs/Wolf.cpp b/src/Mobs/Wolf.cpp
index e074cfe2e..174fee9b1 100644
--- a/src/Mobs/Wolf.cpp
+++ b/src/Mobs/Wolf.cpp
@@ -73,8 +73,12 @@ bool cWolf::Attack(std::chrono::milliseconds a_Dt)
-void cWolf::NearbyPlayerIsFighting(cPlayer * a_Player, cEntity * a_Opponent)
+void cWolf::NearbyPlayerIsFighting(cPlayer * a_Player, cPawn * a_Opponent)
{
+ if (a_Opponent == nullptr)
+ {
+ return;
+ }
if ((m_Target == nullptr) && (a_Player->GetName() == m_OwnerName) && !IsSitting() && (a_Opponent->IsPawn()))
{
m_Target = a_Opponent;
diff --git a/src/Mobs/Wolf.h b/src/Mobs/Wolf.h
index 57178a3f4..90d38f15c 100644
--- a/src/Mobs/Wolf.h
+++ b/src/Mobs/Wolf.h
@@ -51,7 +51,7 @@ public:
- The wolf is not already attacking a mob.
- The wolf is not sitting.
This is called by cPlayer::NotifyFriendlyWolves whenever a player takes or deals damage and a wolf is nearby. */
- void NearbyPlayerIsFighting(cPlayer * a_Player, cEntity * a_Opponent);
+ void NearbyPlayerIsFighting(cPlayer * a_Player, cPawn * a_Opponent);
virtual void InStateIdle(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;