1
0

Merge pull request #1 from tigerw/bugfixes

Bugfixes branch merge
This commit is contained in:
Tiger Wang 2013-09-17 12:19:12 -07:00
commit 558cc1bf26
2 changed files with 21 additions and 20 deletions

View File

@ -138,10 +138,6 @@ public:
/// Finds a suitable face to place the torch, returning BLOCK_FACE_NONE on failure /// Finds a suitable face to place the torch, returning BLOCK_FACE_NONE on failure
static char FindSuitableFace(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ) static char FindSuitableFace(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ)
{ {
// TODO: If placing a torch from below, check all 4 XZ neighbors, place it on that neighbor instead
// How to propagate that change up?
// Simon: The easiest way is to calculate the position two times, shouldn't cost much cpu power :)
for (int i = 0; i <= 5; i++) for (int i = 0; i <= 5; i++)
{ {
AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, i, true); AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, i, true);
@ -152,12 +148,12 @@ public:
(BlockInQuestion == E_BLOCK_FENCE) || (BlockInQuestion == E_BLOCK_FENCE) ||
(BlockInQuestion == E_BLOCK_NETHER_BRICK_FENCE) || (BlockInQuestion == E_BLOCK_NETHER_BRICK_FENCE) ||
(BlockInQuestion == E_BLOCK_COBBLESTONE_WALL)) && (BlockInQuestion == E_BLOCK_COBBLESTONE_WALL)) &&
(i = 1) (i == BLOCK_FACE_TOP)
) )
{ {
return i; return i;
} }
else if ( g_BlockIsTorchPlaceable[BlockInQuestion] ) else if ((g_BlockIsTorchPlaceable[BlockInQuestion]) && (i != BLOCK_FACE_BOTTOM))
{ {
return i; return i;
} }
@ -193,7 +189,12 @@ public:
BLOCKTYPE BlockInQuestion; BLOCKTYPE BlockInQuestion;
a_Chunk.UnboundedRelGetBlockType(a_RelX, a_RelY, a_RelZ, BlockInQuestion); a_Chunk.UnboundedRelGetBlockType(a_RelX, a_RelY, a_RelZ, BlockInQuestion);
if ((BlockInQuestion == E_BLOCK_GLASS) || (BlockInQuestion == E_BLOCK_FENCE) || (BlockInQuestion == E_BLOCK_NETHER_BRICK_FENCE)) if (
(BlockInQuestion == E_BLOCK_GLASS) ||
(BlockInQuestion == E_BLOCK_FENCE) ||
(BlockInQuestion == E_BLOCK_NETHER_BRICK_FENCE) ||
(BlockInQuestion == E_BLOCK_COBBLESTONE_WALL)
)
{ {
// Torches can be placed on tops of glass and fences, despite them being 'untorcheable' // Torches can be placed on tops of glass and fences, despite them being 'untorcheable'
// No need to check for upright orientation, it was done when the torch was placed // No need to check for upright orientation, it was done when the torch was placed

View File

@ -651,21 +651,21 @@ void cEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk)
} }
} }
} }
else }
else
{
// Friction for non-minecarts
if (NextSpeed.SqrLength() > 0.0004f)
{ {
// Friction NextSpeed.x *= 0.7f / (1 + a_Dt);
if (NextSpeed.SqrLength() > 0.0004f) if (fabs(NextSpeed.x) < 0.05)
{ {
NextSpeed.x *= 0.7f / (1 + a_Dt); NextSpeed.x = 0;
if (fabs(NextSpeed.x) < 0.05) }
{ NextSpeed.z *= 0.7f / (1 + a_Dt);
NextSpeed.x = 0; if (fabs(NextSpeed.z) < 0.05)
} {
NextSpeed.z *= 0.7f / (1 + a_Dt); NextSpeed.z = 0;
if (fabs(NextSpeed.z) < 0.05)
{
NextSpeed.z = 0;
}
} }
} }
} }