summaryrefslogtreecommitdiffstats
path: root/src/Mobs
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-01-18 11:21:36 +0100
committerMattes D <github@xoft.cz>2015-01-18 11:21:36 +0100
commite38f41d32fa970c9a1493f9ca0ff16ad3faf33d3 (patch)
tree75983459166f6ebebebcc5e4bfb9c551f4e3aedb /src/Mobs
parentMerge pull request #1707 from UltraCoderRU/master (diff)
parentFixed type-conversion warnings. (diff)
downloadcuberite-e38f41d32fa970c9a1493f9ca0ff16ad3faf33d3.tar
cuberite-e38f41d32fa970c9a1493f9ca0ff16ad3faf33d3.tar.gz
cuberite-e38f41d32fa970c9a1493f9ca0ff16ad3faf33d3.tar.bz2
cuberite-e38f41d32fa970c9a1493f9ca0ff16ad3faf33d3.tar.lz
cuberite-e38f41d32fa970c9a1493f9ca0ff16ad3faf33d3.tar.xz
cuberite-e38f41d32fa970c9a1493f9ca0ff16ad3faf33d3.tar.zst
cuberite-e38f41d32fa970c9a1493f9ca0ff16ad3faf33d3.zip
Diffstat (limited to 'src/Mobs')
-rw-r--r--src/Mobs/AggressiveMonster.cpp8
-rw-r--r--src/Mobs/AggressiveMonster.h6
-rw-r--r--src/Mobs/Blaze.cpp4
-rw-r--r--src/Mobs/Blaze.h2
-rw-r--r--src/Mobs/CaveSpider.cpp4
-rw-r--r--src/Mobs/CaveSpider.h4
-rw-r--r--src/Mobs/Chicken.cpp2
-rw-r--r--src/Mobs/Chicken.h2
-rw-r--r--src/Mobs/Creeper.cpp4
-rw-r--r--src/Mobs/Creeper.h4
-rw-r--r--src/Mobs/Enderman.cpp2
-rw-r--r--src/Mobs/Enderman.h2
-rw-r--r--src/Mobs/Ghast.cpp4
-rw-r--r--src/Mobs/Ghast.h2
-rw-r--r--src/Mobs/Guardian.cpp2
-rw-r--r--src/Mobs/Guardian.h2
-rw-r--r--src/Mobs/Horse.cpp2
-rw-r--r--src/Mobs/Horse.h2
-rw-r--r--src/Mobs/Monster.cpp20
-rw-r--r--src/Mobs/Monster.h12
-rw-r--r--src/Mobs/PassiveMonster.cpp2
-rw-r--r--src/Mobs/PassiveMonster.h2
-rw-r--r--src/Mobs/Pig.cpp2
-rw-r--r--src/Mobs/Pig.h2
-rw-r--r--src/Mobs/Sheep.cpp2
-rw-r--r--src/Mobs/Sheep.h2
-rw-r--r--src/Mobs/Skeleton.cpp4
-rw-r--r--src/Mobs/Skeleton.h2
-rw-r--r--src/Mobs/Slime.cpp2
-rw-r--r--src/Mobs/Slime.h2
-rw-r--r--src/Mobs/SnowGolem.cpp2
-rw-r--r--src/Mobs/SnowGolem.h2
-rw-r--r--src/Mobs/Squid.cpp2
-rw-r--r--src/Mobs/Squid.h2
-rw-r--r--src/Mobs/Villager.cpp2
-rw-r--r--src/Mobs/Villager.h2
-rw-r--r--src/Mobs/Wither.cpp2
-rw-r--r--src/Mobs/Wither.h2
-rw-r--r--src/Mobs/Wolf.cpp4
-rw-r--r--src/Mobs/Wolf.h4
40 files changed, 67 insertions, 69 deletions
diff --git a/src/Mobs/AggressiveMonster.cpp b/src/Mobs/AggressiveMonster.cpp
index 7ca7a9d66..72317d66b 100644
--- a/src/Mobs/AggressiveMonster.cpp
+++ b/src/Mobs/AggressiveMonster.cpp
@@ -22,7 +22,7 @@ cAggressiveMonster::cAggressiveMonster(const AString & a_ConfigName, eMonsterTyp
// What to do if in Chasing State
-void cAggressiveMonster::InStateChasing(float a_Dt)
+void cAggressiveMonster::InStateChasing(std::chrono::milliseconds a_Dt)
{
super::InStateChasing(a_Dt);
@@ -61,7 +61,7 @@ void cAggressiveMonster::EventSeePlayer(cEntity * a_Entity)
-void cAggressiveMonster::Tick(float a_Dt, cChunk & a_Chunk)
+void cAggressiveMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
super::Tick(a_Dt, a_Chunk);
@@ -93,9 +93,9 @@ void cAggressiveMonster::Tick(float a_Dt, cChunk & a_Chunk)
-void cAggressiveMonster::Attack(float a_Dt)
+void cAggressiveMonster::Attack(std::chrono::milliseconds a_Dt)
{
- m_AttackInterval += a_Dt * m_AttackRate;
+ m_AttackInterval += a_Dt.count() * m_AttackRate;
if ((m_Target == nullptr) || (m_AttackInterval < 3.0))
{
diff --git a/src/Mobs/AggressiveMonster.h b/src/Mobs/AggressiveMonster.h
index 2549ba2d3..f64c1103f 100644
--- a/src/Mobs/AggressiveMonster.h
+++ b/src/Mobs/AggressiveMonster.h
@@ -16,11 +16,11 @@ public:
cAggressiveMonster(const AString & a_ConfigName, eMonsterType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height);
- virtual void Tick (float a_Dt, cChunk & a_Chunk) override;
- virtual void InStateChasing(float a_Dt) override;
+ virtual void Tick (std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
+ virtual void InStateChasing(std::chrono::milliseconds a_Dt) override;
virtual void EventSeePlayer(cEntity *) override;
- virtual void Attack(float a_Dt);
+ virtual void Attack(std::chrono::milliseconds a_Dt);
protected:
/** Whether this mob's destination is the same as its target's position. */
diff --git a/src/Mobs/Blaze.cpp b/src/Mobs/Blaze.cpp
index 1fa9d2c37..172ccd071 100644
--- a/src/Mobs/Blaze.cpp
+++ b/src/Mobs/Blaze.cpp
@@ -30,9 +30,9 @@ void cBlaze::GetDrops(cItems & a_Drops, cEntity * a_Killer)
-void cBlaze::Attack(float a_Dt)
+void cBlaze::Attack(std::chrono::milliseconds a_Dt)
{
- m_AttackInterval += a_Dt * m_AttackRate;
+ m_AttackInterval += a_Dt.count() * m_AttackRate;
if ((m_Target != nullptr) && (m_AttackInterval > 3.0))
{
diff --git a/src/Mobs/Blaze.h b/src/Mobs/Blaze.h
index e2a4ad9f1..493953a14 100644
--- a/src/Mobs/Blaze.h
+++ b/src/Mobs/Blaze.h
@@ -18,5 +18,5 @@ public:
CLASS_PROTODEF(cBlaze)
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = nullptr) override;
- virtual void Attack(float a_Dt) override;
+ virtual void Attack(std::chrono::milliseconds a_Dt) override;
} ;
diff --git a/src/Mobs/CaveSpider.cpp b/src/Mobs/CaveSpider.cpp
index 045b47e73..fa530db82 100644
--- a/src/Mobs/CaveSpider.cpp
+++ b/src/Mobs/CaveSpider.cpp
@@ -16,7 +16,7 @@ cCaveSpider::cCaveSpider(void) :
-void cCaveSpider::Tick(float a_Dt, cChunk & a_Chunk)
+void cCaveSpider::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
super::Tick(a_Dt, a_Chunk);
@@ -27,7 +27,7 @@ void cCaveSpider::Tick(float a_Dt, cChunk & a_Chunk)
-void cCaveSpider::Attack(float a_Dt)
+void cCaveSpider::Attack(std::chrono::milliseconds a_Dt)
{
super::Attack(a_Dt);
diff --git a/src/Mobs/CaveSpider.h b/src/Mobs/CaveSpider.h
index 494ba1360..d3e56fd2b 100644
--- a/src/Mobs/CaveSpider.h
+++ b/src/Mobs/CaveSpider.h
@@ -16,8 +16,8 @@ public:
CLASS_PROTODEF(cCaveSpider)
- virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
- virtual void Attack(float a_Dt) override;
+ virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
+ virtual void Attack(std::chrono::milliseconds a_Dt) override;
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = nullptr) override;
} ;
diff --git a/src/Mobs/Chicken.cpp b/src/Mobs/Chicken.cpp
index 634867cfa..b2b21d4ae 100644
--- a/src/Mobs/Chicken.cpp
+++ b/src/Mobs/Chicken.cpp
@@ -18,7 +18,7 @@ cChicken::cChicken(void) :
-void cChicken::Tick(float a_Dt, cChunk & a_Chunk)
+void cChicken::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
super::Tick(a_Dt, a_Chunk);
diff --git a/src/Mobs/Chicken.h b/src/Mobs/Chicken.h
index 07b921884..9349187c6 100644
--- a/src/Mobs/Chicken.h
+++ b/src/Mobs/Chicken.h
@@ -17,7 +17,7 @@ public:
CLASS_PROTODEF(cChicken)
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = nullptr) override;
- virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
+ virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
virtual const cItem GetFollowedItem(void) const override { return cItem(E_ITEM_SEEDS); }
diff --git a/src/Mobs/Creeper.cpp b/src/Mobs/Creeper.cpp
index a073224cf..c4ae47f2f 100644
--- a/src/Mobs/Creeper.cpp
+++ b/src/Mobs/Creeper.cpp
@@ -23,7 +23,7 @@ cCreeper::cCreeper(void) :
-void cCreeper::Tick(float a_Dt, cChunk & a_Chunk)
+void cCreeper::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
super::Tick(a_Dt, a_Chunk);
@@ -119,7 +119,7 @@ bool cCreeper::DoTakeDamage(TakeDamageInfo & a_TDI)
-void cCreeper::Attack(float a_Dt)
+void cCreeper::Attack(std::chrono::milliseconds a_Dt)
{
UNUSED(a_Dt);
diff --git a/src/Mobs/Creeper.h b/src/Mobs/Creeper.h
index bf3272e22..1827c416e 100644
--- a/src/Mobs/Creeper.h
+++ b/src/Mobs/Creeper.h
@@ -19,8 +19,8 @@ public:
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = nullptr) override;
virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) override;
- virtual void Attack(float a_Dt) override;
- virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
+ virtual void Attack(std::chrono::milliseconds a_Dt) override;
+ virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
virtual void OnRightClicked(cPlayer & a_Player) override;
bool IsBlowing(void) const {return m_bIsBlowing; }
diff --git a/src/Mobs/Enderman.cpp b/src/Mobs/Enderman.cpp
index 56ea10245..42c33884a 100644
--- a/src/Mobs/Enderman.cpp
+++ b/src/Mobs/Enderman.cpp
@@ -186,7 +186,7 @@ bool cEnderman::CheckLight()
-void cEnderman::Tick(float a_Dt, cChunk & a_Chunk)
+void cEnderman::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
super::Tick(a_Dt, a_Chunk);
diff --git a/src/Mobs/Enderman.h b/src/Mobs/Enderman.h
index 28bbceb84..8ccbf2ce7 100644
--- a/src/Mobs/Enderman.h
+++ b/src/Mobs/Enderman.h
@@ -21,7 +21,7 @@ public:
virtual void CheckEventSeePlayer(void) override;
virtual void CheckEventLostPlayer(void) override;
virtual void EventLosePlayer(void) override;
- virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
+ virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
bool IsScreaming(void) const {return m_bIsScreaming; }
BLOCKTYPE GetCarriedBlock(void) const {return CarriedBlock; }
diff --git a/src/Mobs/Ghast.cpp b/src/Mobs/Ghast.cpp
index fc8de8362..ea0295102 100644
--- a/src/Mobs/Ghast.cpp
+++ b/src/Mobs/Ghast.cpp
@@ -32,9 +32,9 @@ void cGhast::GetDrops(cItems & a_Drops, cEntity * a_Killer)
-void cGhast::Attack(float a_Dt)
+void cGhast::Attack(std::chrono::milliseconds a_Dt)
{
- m_AttackInterval += a_Dt * m_AttackRate;
+ m_AttackInterval += a_Dt.count() * m_AttackRate;
if ((m_Target != nullptr) && (m_AttackInterval > 3.0))
{
diff --git a/src/Mobs/Ghast.h b/src/Mobs/Ghast.h
index a28940a01..431edaf6d 100644
--- a/src/Mobs/Ghast.h
+++ b/src/Mobs/Ghast.h
@@ -18,7 +18,7 @@ public:
CLASS_PROTODEF(cGhast)
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = nullptr) override;
- virtual void Attack(float a_Dt) override;
+ virtual void Attack(std::chrono::milliseconds a_Dt) override;
bool IsCharging(void) const {return false; }
} ;
diff --git a/src/Mobs/Guardian.cpp b/src/Mobs/Guardian.cpp
index 15908d801..5eb30785b 100644
--- a/src/Mobs/Guardian.cpp
+++ b/src/Mobs/Guardian.cpp
@@ -35,7 +35,7 @@ void cGuardian::GetDrops(cItems & a_Drops, cEntity * a_Killer)
-void cGuardian::Tick(float a_Dt, cChunk & a_Chunk)
+void cGuardian::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
// We must first process current location, and only then tick, otherwise we risk processing a location in a chunk
// that is not where the entity currently resides (FS #411)
diff --git a/src/Mobs/Guardian.h b/src/Mobs/Guardian.h
index 50c034036..6bc17947c 100644
--- a/src/Mobs/Guardian.h
+++ b/src/Mobs/Guardian.h
@@ -15,7 +15,7 @@ class cGuardian :
public:
cGuardian();
- virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
+ virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
CLASS_PROTODEF(cGuardian)
diff --git a/src/Mobs/Horse.cpp b/src/Mobs/Horse.cpp
index d92f0d023..5b4c78bfc 100644
--- a/src/Mobs/Horse.cpp
+++ b/src/Mobs/Horse.cpp
@@ -30,7 +30,7 @@ cHorse::cHorse(int Type, int Color, int Style, int TameTimes) :
-void cHorse::Tick(float a_Dt, cChunk & a_Chunk)
+void cHorse::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
super::Tick(a_Dt, a_Chunk);
diff --git a/src/Mobs/Horse.h b/src/Mobs/Horse.h
index 4c644e512..be283705e 100644
--- a/src/Mobs/Horse.h
+++ b/src/Mobs/Horse.h
@@ -18,7 +18,7 @@ public:
CLASS_PROTODEF(cHorse)
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = nullptr) override;
- virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
+ virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
virtual void OnRightClicked(cPlayer & a_Player) override;
bool IsSaddled (void) const {return m_bIsSaddled; }
diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp
index 425c80bf4..6e07bfbb6 100644
--- a/src/Mobs/Monster.cpp
+++ b/src/Mobs/Monster.cpp
@@ -252,15 +252,15 @@ bool cMonster::ReachedFinalDestination()
-void cMonster::Tick(float a_Dt, cChunk & a_Chunk)
+void cMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
super::Tick(a_Dt, a_Chunk);
if (m_Health <= 0)
{
// The mob is dead, but we're still animating the "puff" they leave when they die
- m_DestroyTimer += a_Dt / 1000;
- if (m_DestroyTimer > 1)
+ m_DestroyTimer += a_Dt;
+ if (m_DestroyTimer > std::chrono::seconds(1))
{
Destroy(true);
}
@@ -275,8 +275,6 @@ void cMonster::Tick(float a_Dt, cChunk & a_Chunk)
// Burning in daylight
HandleDaylightBurning(a_Chunk);
- a_Dt /= 1000;
-
if (m_bMovingToDestination)
{
if (m_bOnGround)
@@ -557,7 +555,7 @@ void cMonster::KilledBy(TakeDamageInfo & a_TDI)
{
m_World->SpawnExperienceOrb(GetPosX(), GetPosY(), GetPosZ(), Reward);
}
- m_DestroyTimer = 0;
+ m_DestroyTimer = std::chrono::milliseconds(0);
}
@@ -640,7 +638,7 @@ void cMonster::EventLosePlayer(void)
-void cMonster::InStateIdle(float a_Dt)
+void cMonster::InStateIdle(std::chrono::milliseconds a_Dt)
{
if (m_bMovingToDestination)
{
@@ -649,11 +647,11 @@ void cMonster::InStateIdle(float a_Dt)
m_IdleInterval += a_Dt;
- if (m_IdleInterval > 1)
+ if (m_IdleInterval > std::chrono::seconds(1))
{
// At this interval the results are predictable
int rem = m_World->GetTickRandomNumber(6) + 1;
- m_IdleInterval -= 1; // So nothing gets dropped when the server hangs for a few seconds
+ m_IdleInterval -= std::chrono::seconds(1); // So nothing gets dropped when the server hangs for a few seconds
Vector3d Dist;
Dist.x = (double)m_World->GetTickRandomNumber(10) - 5;
@@ -680,7 +678,7 @@ void cMonster::InStateIdle(float a_Dt)
// What to do if in Chasing State
// This state should always be defined in each child class
-void cMonster::InStateChasing(float a_Dt)
+void cMonster::InStateChasing(std::chrono::milliseconds a_Dt)
{
UNUSED(a_Dt);
}
@@ -690,7 +688,7 @@ void cMonster::InStateChasing(float a_Dt)
// What to do if in Escaping State
-void cMonster::InStateEscaping(float a_Dt)
+void cMonster::InStateEscaping(std::chrono::milliseconds a_Dt)
{
UNUSED(a_Dt);
diff --git a/src/Mobs/Monster.h b/src/Mobs/Monster.h
index fb1bc550d..21ed0c25a 100644
--- a/src/Mobs/Monster.h
+++ b/src/Mobs/Monster.h
@@ -52,7 +52,7 @@ public:
virtual void SpawnOn(cClientHandle & a_ClientHandle) override;
- virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
+ virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) override;
@@ -80,9 +80,9 @@ public:
virtual void EventLosePlayer(void);
virtual void CheckEventLostPlayer(void);
- virtual void InStateIdle (float a_Dt);
- virtual void InStateChasing (float a_Dt);
- virtual void InStateEscaping(float a_Dt);
+ virtual void InStateIdle (std::chrono::milliseconds a_Dt);
+ virtual void InStateChasing (std::chrono::milliseconds a_Dt);
+ virtual void InStateEscaping(std::chrono::milliseconds a_Dt);
int GetAttackRate() { return static_cast<int>(m_AttackRate); }
void SetAttackRate(float a_AttackRate) { m_AttackRate = a_AttackRate; }
@@ -217,8 +217,8 @@ protected:
/* =========================== */
- float m_IdleInterval;
- float m_DestroyTimer;
+ std::chrono::milliseconds m_IdleInterval;
+ std::chrono::milliseconds m_DestroyTimer;
eMonsterType m_MobType;
AString m_CustomName;
diff --git a/src/Mobs/PassiveMonster.cpp b/src/Mobs/PassiveMonster.cpp
index 1048616d0..012ca9949 100644
--- a/src/Mobs/PassiveMonster.cpp
+++ b/src/Mobs/PassiveMonster.cpp
@@ -35,7 +35,7 @@ bool cPassiveMonster::DoTakeDamage(TakeDamageInfo & a_TDI)
-void cPassiveMonster::Tick(float a_Dt, cChunk & a_Chunk)
+void cPassiveMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
super::Tick(a_Dt, a_Chunk);
diff --git a/src/Mobs/PassiveMonster.h b/src/Mobs/PassiveMonster.h
index 9221d9a6e..2ed2cd21d 100644
--- a/src/Mobs/PassiveMonster.h
+++ b/src/Mobs/PassiveMonster.h
@@ -15,7 +15,7 @@ class cPassiveMonster :
public:
cPassiveMonster(const AString & a_ConfigName, eMonsterType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height);
- virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
+ virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
/// When hit by someone, run away
virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) override;
diff --git a/src/Mobs/Pig.cpp b/src/Mobs/Pig.cpp
index 1e4c35acd..edd4d9de4 100644
--- a/src/Mobs/Pig.cpp
+++ b/src/Mobs/Pig.cpp
@@ -80,7 +80,7 @@ void cPig::OnRightClicked(cPlayer & a_Player)
-void cPig::Tick(float a_Dt, cChunk & a_Chunk)
+void cPig::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
super::Tick(a_Dt, a_Chunk);
diff --git a/src/Mobs/Pig.h b/src/Mobs/Pig.h
index 0e026933a..0fe4b4fed 100644
--- a/src/Mobs/Pig.h
+++ b/src/Mobs/Pig.h
@@ -22,7 +22,7 @@ public:
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = nullptr) override;
virtual void OnRightClicked(cPlayer & a_Player) override;
- virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
+ virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
virtual const cItem GetFollowedItem(void) const override { return cItem(E_ITEM_CARROT); }
diff --git a/src/Mobs/Sheep.cpp b/src/Mobs/Sheep.cpp
index c46404391..e4d1760e0 100644
--- a/src/Mobs/Sheep.cpp
+++ b/src/Mobs/Sheep.cpp
@@ -84,7 +84,7 @@ void cSheep::OnRightClicked(cPlayer & a_Player)
-void cSheep::Tick(float a_Dt, cChunk & a_Chunk)
+void cSheep::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
super::Tick(a_Dt, a_Chunk);
int PosX = POSX_TOINT;
diff --git a/src/Mobs/Sheep.h b/src/Mobs/Sheep.h
index 16d5fddd3..b6c99ac2a 100644
--- a/src/Mobs/Sheep.h
+++ b/src/Mobs/Sheep.h
@@ -24,7 +24,7 @@ public:
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = nullptr) override;
virtual void OnRightClicked(cPlayer & a_Player) override;
- virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
+ virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
virtual const cItem GetFollowedItem(void) const override { return cItem(E_ITEM_WHEAT); }
diff --git a/src/Mobs/Skeleton.cpp b/src/Mobs/Skeleton.cpp
index da5ddc670..dd59d6454 100644
--- a/src/Mobs/Skeleton.cpp
+++ b/src/Mobs/Skeleton.cpp
@@ -67,9 +67,9 @@ void cSkeleton::MoveToPosition(const Vector3d & a_Position)
-void cSkeleton::Attack(float a_Dt)
+void cSkeleton::Attack(std::chrono::milliseconds a_Dt)
{
- m_AttackInterval += a_Dt * m_AttackRate;
+ m_AttackInterval += a_Dt.count() * m_AttackRate;
if ((m_Target != nullptr) && (m_AttackInterval > 3.0))
{
diff --git a/src/Mobs/Skeleton.h b/src/Mobs/Skeleton.h
index cd1c6c3f0..9c49c52fb 100644
--- a/src/Mobs/Skeleton.h
+++ b/src/Mobs/Skeleton.h
@@ -19,7 +19,7 @@ public:
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = nullptr) override;
virtual void MoveToPosition(const Vector3d & a_Position) override;
- virtual void Attack(float a_Dt) override;
+ virtual void Attack(std::chrono::milliseconds a_Dt) override;
virtual void SpawnOn(cClientHandle & a_ClientHandle) override;
virtual bool IsUndead(void) override { return true; }
diff --git a/src/Mobs/Slime.cpp b/src/Mobs/Slime.cpp
index 1c68c5189..e42501e47 100644
--- a/src/Mobs/Slime.cpp
+++ b/src/Mobs/Slime.cpp
@@ -46,7 +46,7 @@ void cSlime::GetDrops(cItems & a_Drops, cEntity * a_Killer)
-void cSlime::Attack(float a_Dt)
+void cSlime::Attack(std::chrono::milliseconds a_Dt)
{
if (m_Size > 1)
{
diff --git a/src/Mobs/Slime.h b/src/Mobs/Slime.h
index a177a279c..29605992d 100644
--- a/src/Mobs/Slime.h
+++ b/src/Mobs/Slime.h
@@ -20,7 +20,7 @@ public:
// cAggressiveMonster overrides:
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = nullptr) override;
- virtual void Attack(float a_Dt) override;
+ virtual void Attack(std::chrono::milliseconds a_Dt) override;
virtual void KilledBy(TakeDamageInfo & a_TDI) override;
int GetSize(void) const { return m_Size; }
diff --git a/src/Mobs/SnowGolem.cpp b/src/Mobs/SnowGolem.cpp
index 8c4178beb..e1510b203 100644
--- a/src/Mobs/SnowGolem.cpp
+++ b/src/Mobs/SnowGolem.cpp
@@ -27,7 +27,7 @@ void cSnowGolem::GetDrops(cItems & a_Drops, cEntity * a_Killer)
-void cSnowGolem::Tick(float a_Dt, cChunk & a_Chunk)
+void cSnowGolem::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
super::Tick(a_Dt, a_Chunk);
if (IsBiomeNoDownfall(m_World->GetBiomeAt((int) floor(GetPosX()), (int) floor(GetPosZ()))))
diff --git a/src/Mobs/SnowGolem.h b/src/Mobs/SnowGolem.h
index f036b1867..9c95e21c5 100644
--- a/src/Mobs/SnowGolem.h
+++ b/src/Mobs/SnowGolem.h
@@ -17,7 +17,7 @@ public:
CLASS_PROTODEF(cSnowGolem)
- virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
+ virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = nullptr) override;
} ;
diff --git a/src/Mobs/Squid.cpp b/src/Mobs/Squid.cpp
index 59ee963ae..3c508b65f 100644
--- a/src/Mobs/Squid.cpp
+++ b/src/Mobs/Squid.cpp
@@ -33,7 +33,7 @@ void cSquid::GetDrops(cItems & a_Drops, cEntity * a_Killer)
-void cSquid::Tick(float a_Dt, cChunk & a_Chunk)
+void cSquid::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
// We must first process current location, and only then tick, otherwise we risk processing a location in a chunk
// that is not where the entity currently resides (FS #411)
diff --git a/src/Mobs/Squid.h b/src/Mobs/Squid.h
index a46d738c6..7e944a17e 100644
--- a/src/Mobs/Squid.h
+++ b/src/Mobs/Squid.h
@@ -15,7 +15,7 @@ class cSquid :
public:
cSquid();
- virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
+ virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
CLASS_PROTODEF(cSquid)
diff --git a/src/Mobs/Villager.cpp b/src/Mobs/Villager.cpp
index 963595347..6f647ac18 100644
--- a/src/Mobs/Villager.cpp
+++ b/src/Mobs/Villager.cpp
@@ -51,7 +51,7 @@ bool cVillager::DoTakeDamage(TakeDamageInfo & a_TDI)
-void cVillager::Tick(float a_Dt, cChunk & a_Chunk)
+void cVillager::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
super::Tick(a_Dt, a_Chunk);
diff --git a/src/Mobs/Villager.h b/src/Mobs/Villager.h
index d3a38dbf0..2de79295c 100644
--- a/src/Mobs/Villager.h
+++ b/src/Mobs/Villager.h
@@ -31,7 +31,7 @@ public:
// cEntity overrides
virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) override;
- virtual void Tick (float a_Dt, cChunk & a_Chunk) override;
+ virtual void Tick (std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
// cVillager functions
/** return true if the given blocktype are: crops, potatoes or carrots.*/
diff --git a/src/Mobs/Wither.cpp b/src/Mobs/Wither.cpp
index 578b47995..6ef81ce1b 100644
--- a/src/Mobs/Wither.cpp
+++ b/src/Mobs/Wither.cpp
@@ -66,7 +66,7 @@ bool cWither::DoTakeDamage(TakeDamageInfo & a_TDI)
-void cWither::Tick(float a_Dt, cChunk & a_Chunk)
+void cWither::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
super::Tick(a_Dt, a_Chunk);
diff --git a/src/Mobs/Wither.h b/src/Mobs/Wither.h
index a20fed3d3..9e333c7fa 100644
--- a/src/Mobs/Wither.h
+++ b/src/Mobs/Wither.h
@@ -28,7 +28,7 @@ public:
virtual bool Initialize(cWorld & a_World) override;
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = nullptr) override;
virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) override;
- virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
+ virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
virtual void KilledBy(TakeDamageInfo & a_TDI) override;
virtual bool IsUndead(void) override { return true; }
diff --git a/src/Mobs/Wolf.cpp b/src/Mobs/Wolf.cpp
index 4711d5a7a..b3eefdf79 100644
--- a/src/Mobs/Wolf.cpp
+++ b/src/Mobs/Wolf.cpp
@@ -43,7 +43,7 @@ bool cWolf::DoTakeDamage(TakeDamageInfo & a_TDI)
-void cWolf::Attack(float a_Dt)
+void cWolf::Attack(std::chrono::milliseconds a_Dt)
{
UNUSED(a_Dt);
@@ -145,7 +145,7 @@ void cWolf::OnRightClicked(cPlayer & a_Player)
-void cWolf::Tick(float a_Dt, cChunk & a_Chunk)
+void cWolf::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
if (!IsAngry())
{
diff --git a/src/Mobs/Wolf.h b/src/Mobs/Wolf.h
index 7500854f8..73ffb55c2 100644
--- a/src/Mobs/Wolf.h
+++ b/src/Mobs/Wolf.h
@@ -20,9 +20,9 @@ public:
virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) override;
virtual void OnRightClicked(cPlayer & a_Player) override;
- virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
+ virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
virtual void TickFollowPlayer();
- virtual void Attack(float a_Dt) override;
+ virtual void Attack(std::chrono::milliseconds a_Dt) override;
// Get functions
bool IsSitting (void) const { return m_IsSitting; }