summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-01-18 11:02:17 +0100
committerMattes D <github@xoft.cz>2015-01-18 11:02:17 +0100
commite211aafaa45b0e4a12e9c50ee445377077ea8172 (patch)
tree649827f49829a154a4154d2368ea923f479af58c
parentcorrect comment to say milliseconds (diff)
downloadcuberite-e211aafaa45b0e4a12e9c50ee445377077ea8172.tar
cuberite-e211aafaa45b0e4a12e9c50ee445377077ea8172.tar.gz
cuberite-e211aafaa45b0e4a12e9c50ee445377077ea8172.tar.bz2
cuberite-e211aafaa45b0e4a12e9c50ee445377077ea8172.tar.lz
cuberite-e211aafaa45b0e4a12e9c50ee445377077ea8172.tar.xz
cuberite-e211aafaa45b0e4a12e9c50ee445377077ea8172.tar.zst
cuberite-e211aafaa45b0e4a12e9c50ee445377077ea8172.zip
-rw-r--r--src/Bindings/LuaState.cpp2
-rw-r--r--src/Entities/Entity.cpp8
-rw-r--r--src/Entities/FireworkEntity.cpp4
-rw-r--r--src/Entities/Minecart.cpp2
4 files changed, 8 insertions, 8 deletions
diff --git a/src/Bindings/LuaState.cpp b/src/Bindings/LuaState.cpp
index 4bc9906ee..01d3ac687 100644
--- a/src/Bindings/LuaState.cpp
+++ b/src/Bindings/LuaState.cpp
@@ -843,7 +843,7 @@ void cLuaState::Push(std::chrono::milliseconds a_Value)
{
ASSERT(IsValid());
- tolua_pushnumber(m_LuaState, a_Value.count());
+ tolua_pushnumber(m_LuaState, static_cast<lua_Number>(a_Value.count()));
m_NumCurrentFunctionArgs += 1;
}
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp
index c64d94528..c51a27961 100644
--- a/src/Entities/Entity.cpp
+++ b/src/Entities/Entity.cpp
@@ -927,11 +927,11 @@ void cEntity::HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
if (!m_bOnGround)
{
- float fallspeed;
+ double fallspeed;
if (IsBlockWater(BlockIn))
{
fallspeed = m_Gravity * DtSec.count() / 3; // Fall 3x slower in water
- ApplyFriction(NextSpeed, 0.7, DtSec.count());
+ ApplyFriction(NextSpeed, 0.7, static_cast<float>(DtSec.count()));
}
else if (BlockIn == E_BLOCK_COBWEB)
{
@@ -943,11 +943,11 @@ void cEntity::HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
// Normal gravity
fallspeed = m_Gravity * DtSec.count();
}
- NextSpeed.y += fallspeed;
+ NextSpeed.y += static_cast<float>(fallspeed);
}
else
{
- ApplyFriction(NextSpeed, 0.7, DtSec.count());
+ ApplyFriction(NextSpeed, 0.7, static_cast<float>(DtSec.count()));
}
// Adjust X and Z speed for COBWEB temporary. This speed modification should be handled inside block handlers since we
diff --git a/src/Entities/FireworkEntity.cpp b/src/Entities/FireworkEntity.cpp
index 9dc7850a7..32eaf669a 100644
--- a/src/Entities/FireworkEntity.cpp
+++ b/src/Entities/FireworkEntity.cpp
@@ -28,7 +28,7 @@ void cFireworkEntity::HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a_C
if ((PosY < 0) || (PosY >= cChunkDef::Height))
{
AddSpeedY(1);
- AddPosition(GetSpeed() * (a_Dt.count() / 1000));
+ AddPosition(GetSpeed() * (static_cast<double>(a_Dt.count()) / 1000));
return;
}
@@ -53,7 +53,7 @@ void cFireworkEntity::HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a_C
}
AddSpeedY(1);
- AddPosition(GetSpeed() * (a_Dt.count() / 1000));
+ AddPosition(GetSpeed() * (static_cast<double>(a_Dt.count()) / 1000));
}
diff --git a/src/Entities/Minecart.cpp b/src/Entities/Minecart.cpp
index a906c9767..776f957f4 100644
--- a/src/Entities/Minecart.cpp
+++ b/src/Entities/Minecart.cpp
@@ -177,7 +177,7 @@ void cMinecart::HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
default: VERIFY(!"Unhandled rail type despite checking if block was rail!"); break;
}
- AddPosition(GetSpeed() * (a_Dt.count() / 1000)); // Commit changes; as we use our own engine when on rails, this needs to be done, whereas it is normally in Entity.cpp
+ AddPosition(GetSpeed() * (static_cast<double>(a_Dt.count()) / 1000)); // Commit changes; as we use our own engine when on rails, this needs to be done, whereas it is normally in Entity.cpp
}
else
{