summaryrefslogtreecommitdiffstats
path: root/src/Entities/Pickup.cpp
diff options
context:
space:
mode:
authorTycho <work.tycho+git@gmail.com>2015-01-16 14:49:22 +0100
committerTycho <work.tycho+git@gmail.com>2015-01-16 14:56:18 +0100
commit05c40db060809612e6d0bb3bee596c4c95ce758d (patch)
tree72d1912f0f0be7820aff04040e3edfd874d88767 /src/Entities/Pickup.cpp
parentConverted MinecartEntity to std::chrono (diff)
downloadcuberite-05c40db060809612e6d0bb3bee596c4c95ce758d.tar
cuberite-05c40db060809612e6d0bb3bee596c4c95ce758d.tar.gz
cuberite-05c40db060809612e6d0bb3bee596c4c95ce758d.tar.bz2
cuberite-05c40db060809612e6d0bb3bee596c4c95ce758d.tar.lz
cuberite-05c40db060809612e6d0bb3bee596c4c95ce758d.tar.xz
cuberite-05c40db060809612e6d0bb3bee596c4c95ce758d.tar.zst
cuberite-05c40db060809612e6d0bb3bee596c4c95ce758d.zip
Diffstat (limited to 'src/Entities/Pickup.cpp')
-rw-r--r--src/Entities/Pickup.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/Entities/Pickup.cpp b/src/Entities/Pickup.cpp
index accb42a63..9f2609894 100644
--- a/src/Entities/Pickup.cpp
+++ b/src/Entities/Pickup.cpp
@@ -86,7 +86,7 @@ protected:
cPickup::cPickup(double a_PosX, double a_PosY, double a_PosZ, const cItem & a_Item, bool IsPlayerCreated, float a_SpeedX /* = 0.f */, float a_SpeedY /* = 0.f */, float a_SpeedZ /* = 0.f */)
: cEntity(etPickup, a_PosX, a_PosY, a_PosZ, 0.2, 0.2)
- , m_Timer(0.f)
+ , m_Timer(0)
, m_Item(a_Item)
, m_bCollected(false)
, m_bIsPlayerCreated(IsPlayerCreated)
@@ -115,7 +115,7 @@ void cPickup::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
super::Tick(a_Dt, a_Chunk);
BroadcastMovementUpdate(); // Notify clients of position
- m_Timer += a_Dt.count();
+ m_Timer += a_Dt;
if (!m_bCollected)
{
@@ -141,9 +141,9 @@ void cPickup::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
)
{
m_bCollected = true;
- m_Timer = 0; // We have to reset the timer.
- m_Timer += a_Dt.count(); // In case we have to destroy the pickup in the same tick.
- if (m_Timer > 500.f)
+ m_Timer = std::chrono::milliseconds(0); // We have to reset the timer.
+ m_Timer += a_Dt; // In case we have to destroy the pickup in the same tick.
+ if (m_Timer > std::chrono::milliseconds(500))
{
Destroy(true);
return;
@@ -167,14 +167,14 @@ void cPickup::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
}
else
{
- if (m_Timer > 500.f) // 0.5 second
+ if (m_Timer > std::chrono::milliseconds(500)) // 0.5 second
{
Destroy(true);
return;
}
}
- if (m_Timer > 1000 * 60 * 5) // 5 minutes
+ if (m_Timer > std::chrono::minutes(5)) // 5 minutes
{
Destroy(true);
return;
@@ -200,7 +200,7 @@ bool cPickup::CollectedBy(cPlayer & a_Dest)
}
// Two seconds if player created the pickup (vomiting), half a second if anything else
- if (m_Timer < (m_bIsPlayerCreated ? 2000.f : 500.f))
+ if (m_Timer < (m_bIsPlayerCreated ? std::chrono::seconds(2) : std::chrono::milliseconds(500)))
{
// LOG("Pickup %d cannot be collected by \"%s\", because it is not old enough.", m_UniqueID, a_Dest->GetName().c_str());
return false; // Not old enough
@@ -234,7 +234,7 @@ bool cPickup::CollectedBy(cPlayer & a_Dest)
// All of the pickup has been collected, schedule the pickup for destroying
m_bCollected = true;
}
- m_Timer = 0;
+ m_Timer = std::chrono::milliseconds(0);
return true;
}