summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-04-24 23:03:47 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-04-24 23:03:47 +0200
commitc949c1e7550fda892957bccaa81c53e9c2215935 (patch)
treeaf230a98c961cc7778bfd99a192a1fb2f9f7201e
parentMerge branch 'master' into fixes (diff)
downloadcuberite-c949c1e7550fda892957bccaa81c53e9c2215935.tar
cuberite-c949c1e7550fda892957bccaa81c53e9c2215935.tar.gz
cuberite-c949c1e7550fda892957bccaa81c53e9c2215935.tar.bz2
cuberite-c949c1e7550fda892957bccaa81c53e9c2215935.tar.lz
cuberite-c949c1e7550fda892957bccaa81c53e9c2215935.tar.xz
cuberite-c949c1e7550fda892957bccaa81c53e9c2215935.tar.zst
cuberite-c949c1e7550fda892957bccaa81c53e9c2215935.zip
-rw-r--r--src/Entities/Entity.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp
index 5c7c9c95a..f535faac7 100644
--- a/src/Entities/Entity.cpp
+++ b/src/Entities/Entity.cpp
@@ -1,3 +1,4 @@
+
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "Entity.h"
@@ -722,11 +723,9 @@ void cEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk)
if (NextSpeed.SqrLength() > 0.f)
{
cTracer Tracer(GetWorld());
-
- bool HasHit = Tracer.Trace(NextPos, NextSpeed,
- // Distance traced is an integer, so we round up from the distance we should go (Speed * Delta), else we will encounter collision detection failures
- (int)(ceil((NextSpeed * a_Dt).SqrLength()) * 2)
- );
+ // Distance traced is an integer, so we round up from the distance we should go (Speed * Delta), else we will encounter collision detection failurse
+ int DistanceToTrace = (int)(ceil((NextSpeed * a_Dt).SqrLength()) * 2);
+ bool HasHit = Tracer.Trace(NextPos, NextSpeed, DistanceToTrace);
if (HasHit)
{
@@ -736,7 +735,7 @@ void cEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk)
{
// Block hit was within our projected path
// Begin by stopping movement in the direction that we hit something. The Normal is the line perpendicular to a 2D face and in this case, stores what block face was hit through either -1 or 1.
- // Por ejemplo: HitNormal.y = -1 : BLOCK_FACE_YM; HitNormal.y = 1 : BLOCK_FACE_YP
+ // For example: HitNormal.y = -1 : BLOCK_FACE_YM; HitNormal.y = 1 : BLOCK_FACE_YP
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;
@@ -954,7 +953,7 @@ void cEntity::SetSwimState(cChunk & a_Chunk)
// Ref.: http://forum.mc-server.org/showthread.php?tid=1244
LOGD("SetSwimState failure: RelX = %d, RelZ = %d, Pos = %.02f, %.02f}",
RelX, RelY, GetPosX(), GetPosZ()
- );
+ );
m_IsSwimming = false;
m_IsSubmerged = false;
return;