cTracer doesn't attempt a trace above the world.

This fixes some crashes with out-of-world entities.
master
madmaxoft 2013-08-24 21:42:11 +02:00
parent b1ad3f8336
commit 46a8b77151
1 changed files with 2 additions and 2 deletions

View File

@ -133,9 +133,9 @@ void cTracer::SetValues(const Vector3f & a_Start, const Vector3f & a_Direction)
int cTracer::Trace( const Vector3f & a_Start, const Vector3f & a_Direction, int a_Distance) int cTracer::Trace( const Vector3f & a_Start, const Vector3f & a_Direction, int a_Distance)
{ {
if (a_Start.y < 0) if ((a_Start.y < 0) || (a_Start.y >= cChunkDef::Height))
{ {
LOGD("%s: Start is below the world", __FUNCTION__); LOGD("%s: Start Y is outside the world (%d), not tracing.", __FUNCTION__, a_Start.y);
return 0; return 0;
} }