summaryrefslogtreecommitdiffstats
path: root/src/Entities/Minecart.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-08-30 22:11:09 +0200
committermadmaxoft <github@xoft.cz>2014-08-30 22:11:09 +0200
commitb0a7d93ae1b3de1a6c14caf30f26682108b4a6b7 (patch)
tree877d13510c1cf1d48df5fad6e39a74920569e2e7 /src/Entities/Minecart.cpp
parentMerge pull request #1340 from Masy98/crafting (diff)
downloadcuberite-b0a7d93ae1b3de1a6c14caf30f26682108b4a6b7.tar
cuberite-b0a7d93ae1b3de1a6c14caf30f26682108b4a6b7.tar.gz
cuberite-b0a7d93ae1b3de1a6c14caf30f26682108b4a6b7.tar.bz2
cuberite-b0a7d93ae1b3de1a6c14caf30f26682108b4a6b7.tar.lz
cuberite-b0a7d93ae1b3de1a6c14caf30f26682108b4a6b7.tar.xz
cuberite-b0a7d93ae1b3de1a6c14caf30f26682108b4a6b7.tar.zst
cuberite-b0a7d93ae1b3de1a6c14caf30f26682108b4a6b7.zip
Diffstat (limited to 'src/Entities/Minecart.cpp')
-rw-r--r--src/Entities/Minecart.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/Entities/Minecart.cpp b/src/Entities/Minecart.cpp
index 21c58fdba..1501eea84 100644
--- a/src/Entities/Minecart.cpp
+++ b/src/Entities/Minecart.cpp
@@ -891,31 +891,31 @@ bool cMinecart::TestEntityCollision(NIBBLETYPE a_RailMeta)
)
{
// Moving -X +Z
- if ((-GetSpeedX() * 0.4 / sqrt(2)) < 0.01)
+ if ((-GetSpeedX() * 0.4 / sqrt(2.0)) < 0.01)
{
// ~ SpeedX >= 0 Immobile or not moving in the "right" direction. Give it a bump!
- AddSpeedX(-4 / sqrt(2));
- AddSpeedZ(4 / sqrt(2));
+ AddSpeedX(-4 / sqrt(2.0));
+ AddSpeedZ(4 / sqrt(2.0));
}
else
{
// ~ SpeedX < 0 Moving in the "right" direction. Only accelerate it a bit.
- SetSpeedX(GetSpeedX() * 0.4 / sqrt(2));
- SetSpeedZ(GetSpeedZ() * 0.4 / sqrt(2));
+ SetSpeedX(GetSpeedX() * 0.4 / sqrt(2.0));
+ SetSpeedZ(GetSpeedZ() * 0.4 / sqrt(2.0));
}
}
- else if ((GetSpeedX() * 0.4 / sqrt(2)) < 0.01)
+ else if ((GetSpeedX() * 0.4 / sqrt(2.0)) < 0.01)
{
// Moving +X -Z
// ~ SpeedX <= 0 Immobile or not moving in the "right" direction
- AddSpeedX(4 / sqrt(2));
- AddSpeedZ(-4 / sqrt(2));
+ AddSpeedX(4 / sqrt(2.0));
+ AddSpeedZ(-4 / sqrt(2.0));
}
else
{
// ~ SpeedX > 0 Moving in the "right" direction
- SetSpeedX(GetSpeedX() * 0.4 / sqrt(2));
- SetSpeedZ(GetSpeedZ() * 0.4 / sqrt(2));
+ SetSpeedX(GetSpeedX() * 0.4 / sqrt(2.0));
+ SetSpeedZ(GetSpeedZ() * 0.4 / sqrt(2.0));
}
break;
}
@@ -943,28 +943,28 @@ bool cMinecart::TestEntityCollision(NIBBLETYPE a_RailMeta)
if ((GetSpeedX() * 0.4) < 0.01)
{
// ~ SpeedX <= 0 Immobile or not moving in the "right" direction
- AddSpeedX(4 / sqrt(2));
- AddSpeedZ(4 / sqrt(2));
+ AddSpeedX(4 / sqrt(2.0));
+ AddSpeedZ(4 / sqrt(2.0));
}
else
{
// ~ SpeedX > 0 Moving in the "right" direction
- SetSpeedX(GetSpeedX() * 0.4 / sqrt(2));
- SetSpeedZ(GetSpeedZ() * 0.4 / sqrt(2));
+ SetSpeedX(GetSpeedX() * 0.4 / sqrt(2.0));
+ SetSpeedZ(GetSpeedZ() * 0.4 / sqrt(2.0));
}
}
else if ((-GetSpeedX() * 0.4) < 0.01)
{
// Moving -X -Z
// ~ SpeedX >= 0 Immobile or not moving in the "right" direction
- AddSpeedX(-4 / sqrt(2));
- AddSpeedZ(-4 / sqrt(2));
+ AddSpeedX(-4 / sqrt(2.0));
+ AddSpeedZ(-4 / sqrt(2.0));
}
else
{
// ~ SpeedX < 0 Moving in the "right" direction
- SetSpeedX(GetSpeedX() * 0.4 / sqrt(2));
- SetSpeedZ(GetSpeedZ() * 0.4 / sqrt(2));
+ SetSpeedX(GetSpeedX() * 0.4 / sqrt(2.0));
+ SetSpeedZ(GetSpeedZ() * 0.4 / sqrt(2.0));
}
break;
}