summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWoazboat <f.kargl@posteo.de>2016-02-23 22:27:42 +0100
committerWoazboat <f.kargl@posteo.de>2016-04-22 22:56:40 +0200
commit0d5a219eff609b6725c64283beaa2e4eadb68d01 (patch)
tree9fcbbbc7f09a5f8b22e93df151e35e48cc820fe3
parentMerge pull request #3156 from LogicParrot/hashFix (diff)
downloadcuberite-0d5a219eff609b6725c64283beaa2e4eadb68d01.tar
cuberite-0d5a219eff609b6725c64283beaa2e4eadb68d01.tar.gz
cuberite-0d5a219eff609b6725c64283beaa2e4eadb68d01.tar.bz2
cuberite-0d5a219eff609b6725c64283beaa2e4eadb68d01.tar.lz
cuberite-0d5a219eff609b6725c64283beaa2e4eadb68d01.tar.xz
cuberite-0d5a219eff609b6725c64283beaa2e4eadb68d01.tar.zst
cuberite-0d5a219eff609b6725c64283beaa2e4eadb68d01.zip
Diffstat (limited to '')
-rw-r--r--src/Entities/Minecart.cpp66
1 files changed, 56 insertions, 10 deletions
diff --git a/src/Entities/Minecart.cpp b/src/Entities/Minecart.cpp
index 1b037e830..2b4a26e5c 100644
--- a/src/Entities/Minecart.cpp
+++ b/src/Entities/Minecart.cpp
@@ -25,7 +25,7 @@ class cMinecartCollisionCallback :
{
public:
cMinecartCollisionCallback(Vector3d a_Pos, double a_Height, double a_Width, UInt32 a_UniqueID, UInt32 a_AttacheeUniqueID) :
- m_DoesInteserct(false),
+ m_DoesIntersect(false),
m_CollidedEntityPos(0, 0, 0),
m_Pos(a_Pos),
m_Height(a_Height),
@@ -54,7 +54,7 @@ public:
if (bbEntity.DoesIntersect(bbMinecart))
{
m_CollidedEntityPos = a_Entity->GetPosition();
- m_DoesInteserct = true;
+ m_DoesIntersect = true;
return true;
}
return false;
@@ -62,7 +62,7 @@ public:
bool FoundIntersection(void) const
{
- return m_DoesInteserct;
+ return m_DoesIntersect;
}
Vector3d GetCollidedEntityPosition(void) const
@@ -71,7 +71,7 @@ public:
}
protected:
- bool m_DoesInteserct;
+ bool m_DoesIntersect;
Vector3d m_CollidedEntityPos;
@@ -768,25 +768,71 @@ bool cMinecart::TestBlockCollision(NIBBLETYPE a_RailMeta)
break;
}
case E_META_RAIL_CURVED_ZM_XM:
+ {
+ BLOCKTYPE BlockXM = m_World->GetBlock(POSX_TOINT - 1, POSY_TOINT, POSZ_TOINT);
+ BLOCKTYPE BlockZM = m_World->GetBlock(POSX_TOINT, POSY_TOINT, POSZ_TOINT - 1);
+
+ if (
+ ((GetSpeedZ() < 0) && (!IsBlockRail(BlockZM) && cBlockInfo::IsSolid(BlockZM))) ||
+ ((GetSpeedX() < 0) && (!IsBlockRail(BlockXM) && cBlockInfo::IsSolid(BlockXM)))
+ )
+ {
+ SetSpeed(0, 0, 0);
+ SetPosition(POSX_TOINT + 0.5, GetPosY(), POSZ_TOINT + 0.5);
+ return true;
+ }
+
+ break;
+ }
case E_META_RAIL_CURVED_ZM_XP:
+ {
+ BLOCKTYPE BlockXP = m_World->GetBlock(POSX_TOINT + 1, POSY_TOINT, POSZ_TOINT);
+ BLOCKTYPE BlockZM = m_World->GetBlock(POSX_TOINT, POSY_TOINT, POSZ_TOINT - 1);
+
+ if (
+ ((GetSpeedZ() < 0) && (!IsBlockRail(BlockZM) && cBlockInfo::IsSolid(BlockZM))) ||
+ ((GetSpeedX() > 0) && (!IsBlockRail(BlockXP) && cBlockInfo::IsSolid(BlockXP)))
+ )
+ {
+ SetSpeed(0, 0, 0);
+ SetPosition(POSX_TOINT + 0.5, GetPosY(), POSZ_TOINT + 0.5);
+ return true;
+ }
+
+ break;
+ }
case E_META_RAIL_CURVED_ZP_XM:
- case E_META_RAIL_CURVED_ZP_XP:
{
BLOCKTYPE BlockXM = m_World->GetBlock(POSX_TOINT - 1, POSY_TOINT, POSZ_TOINT);
+ BLOCKTYPE BlockZP = m_World->GetBlock(POSX_TOINT, POSY_TOINT, POSZ_TOINT + 1);
+
+ if (
+ ((GetSpeedZ() > 0) && (!IsBlockRail(BlockZP) && cBlockInfo::IsSolid(BlockZP))) ||
+ ((GetSpeedX() < 0) && (!IsBlockRail(BlockXM) && cBlockInfo::IsSolid(BlockXM)))
+ )
+ {
+ SetSpeed(0, 0, 0);
+ SetPosition(POSX_TOINT + 0.5, GetPosY(), POSZ_TOINT + 0.5);
+ return true;
+ }
+
+ break;
+ }
+ case E_META_RAIL_CURVED_ZP_XP:
+ {
BLOCKTYPE BlockXP = m_World->GetBlock(POSX_TOINT + 1, POSY_TOINT, POSZ_TOINT);
- BLOCKTYPE BlockZM = m_World->GetBlock(POSX_TOINT, POSY_TOINT, POSZ_TOINT - 1);
BLOCKTYPE BlockZP = m_World->GetBlock(POSX_TOINT, POSY_TOINT, POSZ_TOINT + 1);
+
if (
- (!IsBlockRail(BlockXM) && cBlockInfo::IsSolid(BlockXM)) ||
- (!IsBlockRail(BlockXP) && cBlockInfo::IsSolid(BlockXP)) ||
- (!IsBlockRail(BlockZM) && cBlockInfo::IsSolid(BlockZM)) ||
- (!IsBlockRail(BlockZP) && cBlockInfo::IsSolid(BlockZP))
+ ((GetSpeedZ() > 0) && (!IsBlockRail(BlockZP) && cBlockInfo::IsSolid(BlockZP))) ||
+ ((GetSpeedX() > 0) && (!IsBlockRail(BlockXP) && cBlockInfo::IsSolid(BlockXP)))
)
{
SetSpeed(0, 0, 0);
SetPosition(POSX_TOINT + 0.5, GetPosY(), POSZ_TOINT + 0.5);
return true;
}
+
break;
}
default: break;