summaryrefslogtreecommitdiffstats
path: root/source/Entities/Entity.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2013-09-12 11:25:13 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2013-09-12 11:25:13 +0200
commit8163ca954910d615b260d62881a06b45c9b7d05c (patch)
tree4a090dc2df3f992cfeef954ba6e2d7579e1942f7 /source/Entities/Entity.cpp
parentImplemented xoft's suggestions (diff)
downloadcuberite-8163ca954910d615b260d62881a06b45c9b7d05c.tar
cuberite-8163ca954910d615b260d62881a06b45c9b7d05c.tar.gz
cuberite-8163ca954910d615b260d62881a06b45c9b7d05c.tar.bz2
cuberite-8163ca954910d615b260d62881a06b45c9b7d05c.tar.lz
cuberite-8163ca954910d615b260d62881a06b45c9b7d05c.tar.xz
cuberite-8163ca954910d615b260d62881a06b45c9b7d05c.tar.zst
cuberite-8163ca954910d615b260d62881a06b45c9b7d05c.zip
Diffstat (limited to 'source/Entities/Entity.cpp')
-rw-r--r--source/Entities/Entity.cpp35
1 files changed, 16 insertions, 19 deletions
diff --git a/source/Entities/Entity.cpp b/source/Entities/Entity.cpp
index 3cb53a6c6..4d7206965 100644
--- a/source/Entities/Entity.cpp
+++ b/source/Entities/Entity.cpp
@@ -1,4 +1,3 @@
-
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "Entity.h"
@@ -520,27 +519,25 @@ void cEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk)
// Push out entity.
BLOCKTYPE GotBlock;
- static const struct
- {
- int x, y, z;
- } gCrossCoords[] =
+ static const Vector3i CrossCoords[] =
{
- { 1, 0, 0},
- {-1, 0, 0},
- { 0, 0, 1},
- { 0, 0, -1},
+ Vector3i(1, 0, 0),
+ Vector3i(-1, 0, 0),
+ Vector3i(0, 0, 1),
+ Vector3i(0, 0, -1),
} ;
-
- for (int i = 0; i < ARRAYCOUNT(gCrossCoords); i++)
+ Vector3i PushDirection(0, 1, 0);
+
+ for (int i = 0; i < ARRAYCOUNT(CrossCoords); i++)
{
- NextChunk->UnboundedRelGetBlockType(RelBlockX + gCrossCoords[i].x, BlockY, RelBlockZ + gCrossCoords[i].z, GotBlock);
- if (GotBlock == E_BLOCK_AIR)
- {
- NextPos.x += gCrossCoords[i].x;
- NextPos.z += gCrossCoords[i].z;
- }
- else { NextPos.y += 0.2; }
- } // for i - gCrossCoords[]
+ NextChunk->UnboundedRelGetBlockType(RelBlockX + CrossCoords[i].x, BlockY, RelBlockZ + CrossCoords[i].z, GotBlock);
+ if (!g_BlockIsSolid[GotBlock])
+ {
+ PushDirection = CrossCoords[i];
+ break;
+ }
+ } // for i - CrossCoords[]
+ NextPos += Vector3d(PushDirection) * 0.2;
m_bOnGround = true;