summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Monster.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-10-20 22:55:07 +0200
committerarchshift <admin@archshift.com>2014-10-23 05:12:49 +0200
commita26541a7c3ced0569098edd0aae61c097c2912f4 (patch)
tree4b7bea204c0ddd18bb4f95357f9eb77590bc2e8d /src/Mobs/Monster.cpp
parentComposableGenerator: Removed nullptr initializers. (diff)
downloadcuberite-a26541a7c3ced0569098edd0aae61c097c2912f4.tar
cuberite-a26541a7c3ced0569098edd0aae61c097c2912f4.tar.gz
cuberite-a26541a7c3ced0569098edd0aae61c097c2912f4.tar.bz2
cuberite-a26541a7c3ced0569098edd0aae61c097c2912f4.tar.lz
cuberite-a26541a7c3ced0569098edd0aae61c097c2912f4.tar.xz
cuberite-a26541a7c3ced0569098edd0aae61c097c2912f4.tar.zst
cuberite-a26541a7c3ced0569098edd0aae61c097c2912f4.zip
Diffstat (limited to '')
-rw-r--r--src/Mobs/Monster.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp
index 73dbcb3c3..23b4d9f45 100644
--- a/src/Mobs/Monster.cpp
+++ b/src/Mobs/Monster.cpp
@@ -79,7 +79,7 @@ cMonster::cMonster(const AString & a_ConfigName, eMonsterType a_MobType, const A
: super(etMonster, a_Width, a_Height)
, m_EMState(IDLE)
, m_EMPersonality(AGGRESSIVE)
- , m_Target(NULL)
+ , m_Target(nullptr)
, m_bMovingToDestination(false)
, m_LastGroundHeight(POSY_TOINT)
, m_IdleInterval(0)
@@ -274,8 +274,8 @@ void cMonster::Tick(float a_Dt, cChunk & a_Chunk)
return;
}
- if ((m_Target != NULL) && m_Target->IsDestroyed())
- m_Target = NULL;
+ if ((m_Target != nullptr) && m_Target->IsDestroyed())
+ m_Target = nullptr;
// Burning in daylight
HandleDaylightBurning(a_Chunk);
@@ -379,7 +379,7 @@ void cMonster::Tick(float a_Dt, cChunk & a_Chunk)
void cMonster::SetPitchAndYawFromDestination()
{
Vector3d FinalDestination = m_FinalDestination;
- if (m_Target != NULL)
+ if (m_Target != nullptr)
{
if (m_Target->IsPlayer())
{
@@ -423,7 +423,7 @@ void cMonster::HandleFalling()
if (Damage > 0)
{
- TakeDamage(dtFalling, NULL, Damage, Damage, 0);
+ TakeDamage(dtFalling, nullptr, Damage, Damage, 0);
// Fall particles
GetWorld()->BroadcastSoundParticleEffect(2006, POSX_TOINT, POSY_TOINT - 1, POSZ_TOINT, Damage /* Used as particle effect speed modifier */);
@@ -479,7 +479,7 @@ bool cMonster::DoTakeDamage(TakeDamageInfo & a_TDI)
m_World->BroadcastSoundEffect(m_SoundHurt, GetPosX(), GetPosY(), GetPosZ(), 1.0f, 0.8f);
}
- if (a_TDI.Attacker != NULL)
+ if (a_TDI.Attacker != nullptr)
{
m_Target = a_TDI.Attacker;
}
@@ -556,7 +556,7 @@ void cMonster::KilledBy(TakeDamageInfo & a_TDI)
break;
}
}
- if ((a_TDI.Attacker != NULL) && (!IsBaby()))
+ if ((a_TDI.Attacker != nullptr) && (!IsBaby()))
{
m_World->SpawnExperienceOrb(GetPosX(), GetPosY(), GetPosZ(), Reward);
}
@@ -593,7 +593,7 @@ void cMonster::CheckEventSeePlayer(void)
// TODO: Rewrite this to use cWorld's DoWithPlayers()
cPlayer * Closest = m_World->FindClosestPlayer(GetPosition(), (float)m_SightDistance, false);
- if (Closest != NULL)
+ if (Closest != nullptr)
{
EventSeePlayer(Closest);
}
@@ -605,7 +605,7 @@ void cMonster::CheckEventSeePlayer(void)
void cMonster::CheckEventLostPlayer(void)
{
- if (m_Target != NULL)
+ if (m_Target != nullptr)
{
if ((m_Target->GetPosition() - GetPosition()).Length() > m_SightDistance)
{
@@ -635,7 +635,7 @@ void cMonster::EventSeePlayer(cEntity * a_SeenPlayer)
void cMonster::EventLosePlayer(void)
{
- m_Target = NULL;
+ m_Target = nullptr;
m_EMState = IDLE;
}
@@ -697,7 +697,7 @@ void cMonster::InStateEscaping(float a_Dt)
{
UNUSED(a_Dt);
- if (m_Target != NULL)
+ if (m_Target != nullptr)
{
Vector3d newloc = GetPosition();
newloc.x = (m_Target->GetPosition().x < newloc.x)? (newloc.x + m_SightDistance): (newloc.x - m_SightDistance);
@@ -724,7 +724,7 @@ void cMonster::SetCustomName(const AString & a_CustomName)
m_CustomName = a_CustomName.substr(0, 64);
}
- if (m_World != NULL)
+ if (m_World != nullptr)
{
m_World->BroadcastEntityMetadata(*this);
}
@@ -737,7 +737,7 @@ void cMonster::SetCustomName(const AString & a_CustomName)
void cMonster::SetCustomNameAlwaysVisible(bool a_CustomNameAlwaysVisible)
{
m_CustomNameAlwaysVisible = a_CustomNameAlwaysVisible;
- if (m_World != NULL)
+ if (m_World != nullptr)
{
m_World->BroadcastEntityMetadata(*this);
}
@@ -893,7 +893,7 @@ int cMonster::GetSpawnDelay(cMonster::eFamily a_MobFamily)
cMonster * cMonster::NewMonsterFromType(eMonsterType a_MobType)
{
cFastRandom Random;
- cMonster * toReturn = NULL;
+ cMonster * toReturn = nullptr;
// Create the mob entity
switch (a_MobType)