summaryrefslogtreecommitdiffstats
path: root/src/Entities/Player.cpp
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/Entities/Player.cpp
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/Entities/Player.cpp')
-rw-r--r--src/Entities/Player.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index c88a78a41..c5e6ef626 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -856,7 +856,10 @@ bool cPlayer::DoTakeDamage(TakeDamageInfo & a_TDI)
if (a_TDI.Attacker != nullptr)
{
- NotifyFriendlyWolves(a_TDI.Attacker);
+ if (a_TDI.Attacker->IsPawn())
+ {
+ NotifyFriendlyWolves(static_cast<cPawn*>(a_TDI.Attacker));
+ }
}
m_Stats.AddValue(statDamageTaken, FloorC<StatValue>(a_TDI.FinalDamage * 10 + 0.5));
return true;
@@ -868,16 +871,16 @@ bool cPlayer::DoTakeDamage(TakeDamageInfo & a_TDI)
-void cPlayer::NotifyFriendlyWolves(cEntity * a_Opponent)
+void cPlayer::NotifyFriendlyWolves(cPawn * a_Opponent)
{
ASSERT(a_Opponent != nullptr);
class LookForWolves : public cEntityCallback
{
public:
cPlayer * m_Player;
- cEntity * m_Attacker;
+ cPawn * m_Attacker;
- LookForWolves(cPlayer * a_Me, cEntity * a_MyAttacker) :
+ LookForWolves(cPlayer * a_Me, cPawn * a_MyAttacker) :
m_Player(a_Me),
m_Attacker(a_MyAttacker)
{