summaryrefslogtreecommitdiffstats
path: root/src/Entities
diff options
context:
space:
mode:
authorChristophe Piveteau <chripiveteau@gmail.com>2014-08-13 19:47:43 +0200
committerChristophe Piveteau <chripiveteau@gmail.com>2014-08-13 19:47:43 +0200
commit2d2d4ff33b74eefe053cce4d9a5daada65ed496b (patch)
treede4af4ada3df18a46ab4e5c8e2b22d9fa5dea6e8 /src/Entities
parentAnother intendation error (diff)
downloadcuberite-2d2d4ff33b74eefe053cce4d9a5daada65ed496b.tar
cuberite-2d2d4ff33b74eefe053cce4d9a5daada65ed496b.tar.gz
cuberite-2d2d4ff33b74eefe053cce4d9a5daada65ed496b.tar.bz2
cuberite-2d2d4ff33b74eefe053cce4d9a5daada65ed496b.tar.lz
cuberite-2d2d4ff33b74eefe053cce4d9a5daada65ed496b.tar.xz
cuberite-2d2d4ff33b74eefe053cce4d9a5daada65ed496b.tar.zst
cuberite-2d2d4ff33b74eefe053cce4d9a5daada65ed496b.zip
Diffstat (limited to '')
-rw-r--r--src/Entities/Minecart.cpp48
1 files changed, 22 insertions, 26 deletions
diff --git a/src/Entities/Minecart.cpp b/src/Entities/Minecart.cpp
index cd5e2adaa..45b9782f3 100644
--- a/src/Entities/Minecart.cpp
+++ b/src/Entities/Minecart.cpp
@@ -879,14 +879,15 @@ bool cMinecart::TestEntityCollision(NIBBLETYPE a_RailMeta)
MinecartCollisionCallback.GetCollidedEntityPosition().z - GetPosZ()
);
- if ( Distance.z == 0. )
+ if (Distance.z == 0.)
{
Distance.z = 0.0001;
}
- if ( ((Distance.z>=0)&&((Distance.x/Distance.z)>=1)) || ((Distance.z<0)&&((Distance.x/Distance.z)<=1)) )
+ if (((Distance.z >= 0) && ((Distance.x / Distance.z) >= 1)) ||
+ ((Distance.z<0) && ((Distance.x / Distance.z) <= 1)))
{
- if ( (-GetSpeedX() * 0.4) < 0.01 )
+ if ((-GetSpeedX() * 0.4) < 0.01)
{
AddSpeedX( -4/sqrt(2) );
AddSpeedZ( 4/sqrt(2) );
@@ -897,18 +898,15 @@ bool cMinecart::TestEntityCollision(NIBBLETYPE a_RailMeta)
SetSpeedZ( GetSpeedZ() * 0.4 );
}
}
+ else if ((GetSpeedX() * 0.4) < 0.01)
+ {
+ AddSpeedX( 4/sqrt(2) );
+ AddSpeedZ( -4/sqrt(2) );
+ }
else
{
- if ((GetSpeedX() * 0.4) < 0.01)
- {
- AddSpeedX( 4/sqrt(2) );
- AddSpeedZ( -4/sqrt(2) );
- }
- else
- {
- SetSpeedX( GetSpeedX() * 0.4 );
- SetSpeedZ( -GetSpeedZ() * 0.4 );
- }
+ SetSpeedX( GetSpeedX() * 0.4 );
+ SetSpeedZ( -GetSpeedZ() * 0.4 );
}
break;
}
@@ -921,14 +919,15 @@ bool cMinecart::TestEntityCollision(NIBBLETYPE a_RailMeta)
MinecartCollisionCallback.GetCollidedEntityPosition().z - GetPosZ()
);
- if ( Distance.z == 0. )
+ if (Distance.z == 0.)
{
Distance.z = 0.0001;
}
- if ( ((Distance.z>=0)&&((Distance.x/Distance.z)<=-1)) || ((Distance.z<0)&&((Distance.x/Distance.z)>=-1)) )
+ if (((Distance.z >= 0) && ((Distance.x / Distance.z) <= -1)) ||
+ ((Distance.z<0) && ((Distance.x / Distance.z) >= -1)))
{
- if ( (GetSpeedX() * 0.4) < 0.01 )
+ if ((GetSpeedX() * 0.4) < 0.01)
{
AddSpeedX( 4/sqrt(2) );
AddSpeedZ( 4/sqrt(2) );
@@ -939,18 +938,15 @@ bool cMinecart::TestEntityCollision(NIBBLETYPE a_RailMeta)
SetSpeedZ( GetSpeedZ() * 0.4 );
}
}
+ else if ((-GetSpeedX() * 0.4) < 0.01)
+ {
+ AddSpeedX( -4/sqrt(2) );
+ AddSpeedZ( -4/sqrt(2) );
+ }
else
{
- if ((-GetSpeedX() * 0.4) < 0.01)
- {
- AddSpeedX( -4/sqrt(2) );
- AddSpeedZ( -4/sqrt(2) );
- }
- else
- {
- SetSpeedX( -GetSpeedX() * 0.4 );
- SetSpeedZ( -GetSpeedZ() * 0.4 );
- }
+ SetSpeedX( -GetSpeedX() * 0.4 );
+ SetSpeedZ( -GetSpeedZ() * 0.4 );
}
break;
}