From e8143de01bff31f9e153949d7ab5b0df82629541 Mon Sep 17 00:00:00 2001 From: archshift Date: Thu, 19 Jun 2014 01:49:56 -0700 Subject: Nullify deleted pointers. --- src/Mobs/Skeleton.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/Mobs/Skeleton.cpp') diff --git a/src/Mobs/Skeleton.cpp b/src/Mobs/Skeleton.cpp index e7f3971cc..e3357185d 100644 --- a/src/Mobs/Skeleton.cpp +++ b/src/Mobs/Skeleton.cpp @@ -84,6 +84,7 @@ void cSkeleton::Attack(float a_Dt) if (!Arrow->Initialize(*m_World)) { delete Arrow; + Arrow = NULL; return; } m_World->BroadcastSpawnEntity(*Arrow); -- cgit v1.2.3 From dad0037f987df594d6a1971af5b29f89c2d27901 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sun, 22 Jun 2014 20:44:55 +0100 Subject: Bettered zombie and skeleton AI * Fixed potential issues with skylight detection --- src/Mobs/Skeleton.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/Mobs/Skeleton.cpp') diff --git a/src/Mobs/Skeleton.cpp b/src/Mobs/Skeleton.cpp index e3357185d..0641a3d57 100644 --- a/src/Mobs/Skeleton.cpp +++ b/src/Mobs/Skeleton.cpp @@ -49,11 +49,10 @@ void cSkeleton::GetDrops(cItems & a_Drops, cEntity * a_Killer) void cSkeleton::MoveToPosition(const Vector3f & a_Position) { - // If the destination is in the sun and if it is not night AND the skeleton isn't on fire then block the movement. + // If the destination is sufficiently skylight challenged AND the skeleton isn't on fire then block the movement if ( !IsOnFire() && - (m_World->GetTimeOfDay() < 13187) && - (m_World->GetBlockSkyLight((int) a_Position.x, (int) a_Position.y, (int) a_Position.z) == 15) + (m_World->GetBlockSkyLight((int)floor(a_Position.x), (int)floor(a_Position.y), (int)floor(a_Position.z)) - m_World->GetSkyDarkness() > 8) ) { m_bMovingToDestination = false; -- cgit v1.2.3