summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-03-20 00:07:16 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-03-20 00:07:16 +0100
commita0720a65d631e0f88b93067cc5ca84c650aa41cb (patch)
treee627124d9c9289f0a5eed45a2a9a9696171c041c
parentENUMified shrapnel level (diff)
downloadcuberite-a0720a65d631e0f88b93067cc5ca84c650aa41cb.tar
cuberite-a0720a65d631e0f88b93067cc5ca84c650aa41cb.tar.gz
cuberite-a0720a65d631e0f88b93067cc5ca84c650aa41cb.tar.bz2
cuberite-a0720a65d631e0f88b93067cc5ca84c650aa41cb.tar.lz
cuberite-a0720a65d631e0f88b93067cc5ca84c650aa41cb.tar.xz
cuberite-a0720a65d631e0f88b93067cc5ca84c650aa41cb.tar.zst
cuberite-a0720a65d631e0f88b93067cc5ca84c650aa41cb.zip
-rw-r--r--src/Entities/Entity.cpp21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp
index 97c8e2164..221cbbea7 100644
--- a/src/Entities/Entity.cpp
+++ b/src/Entities/Entity.cpp
@@ -733,22 +733,19 @@ void cEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk)
if( NextSpeed.SqrLength() > 0.f )
{
cTracer Tracer( GetWorld() );
- int Ret = Tracer.Trace( NextPos, NextSpeed, 2 );
- if( Ret ) // Oh noez! we hit something
+ bool HasHit = Tracer.Trace( NextPos, NextSpeed, 2 );
+ if (HasHit) // Oh noez! we hit something
{
// Set to hit position
- if( (Tracer.RealHit - NextPos).SqrLength() <= ( NextSpeed * a_Dt ).SqrLength() )
+ if ((Tracer.RealHit - NextPos).SqrLength() <= (NextSpeed * a_Dt).SqrLength())
{
- if( Ret == 1 )
- {
- if( Tracer.HitNormal.x != 0.f ) NextSpeed.x = 0.f;
- if( Tracer.HitNormal.y != 0.f ) NextSpeed.y = 0.f;
- if( Tracer.HitNormal.z != 0.f ) NextSpeed.z = 0.f;
+ if (Tracer.HitNormal.x != 0.f) NextSpeed.x = 0.f;
+ if (Tracer.HitNormal.y != 0.f) NextSpeed.y = 0.f;
+ if (Tracer.HitNormal.z != 0.f) NextSpeed.z = 0.f;
- if( Tracer.HitNormal.y > 0 ) // means on ground
- {
- m_bOnGround = true;
- }
+ if (Tracer.HitNormal.y > 0) // means on ground
+ {
+ m_bOnGround = true;
}
NextPos.Set(Tracer.RealHit.x,Tracer.RealHit.y,Tracer.RealHit.z);
NextPos.x += Tracer.HitNormal.x * 0.3f;