summaryrefslogtreecommitdiffstats
path: root/src/Entities
diff options
context:
space:
mode:
authorpeterbell10 <peterbell10@live.co.uk>2018-09-24 22:33:39 +0200
committerAlexander Harkness <me@bearbin.net>2018-09-24 22:33:39 +0200
commit4727ed20846bb3d1a9eabb27aaaa9c5524129556 (patch)
treed6206a51db95a15fd3dfadb9691c868fc6bd8bd1 /src/Entities
parentAdd BurnsInDaylight to Lua API and Monsters.ini (#4295) (diff)
downloadcuberite-4727ed20846bb3d1a9eabb27aaaa9c5524129556.tar
cuberite-4727ed20846bb3d1a9eabb27aaaa9c5524129556.tar.gz
cuberite-4727ed20846bb3d1a9eabb27aaaa9c5524129556.tar.bz2
cuberite-4727ed20846bb3d1a9eabb27aaaa9c5524129556.tar.lz
cuberite-4727ed20846bb3d1a9eabb27aaaa9c5524129556.tar.xz
cuberite-4727ed20846bb3d1a9eabb27aaaa9c5524129556.tar.zst
cuberite-4727ed20846bb3d1a9eabb27aaaa9c5524129556.zip
Diffstat (limited to 'src/Entities')
-rw-r--r--src/Entities/ArrowEntity.cpp5
-rw-r--r--src/Entities/Entity.cpp18
-rw-r--r--src/Entities/FallingBlock.cpp10
-rw-r--r--src/Entities/Player.cpp8
-rw-r--r--src/Entities/ProjectileEntity.cpp23
-rw-r--r--src/Entities/TNTEntity.cpp2
6 files changed, 30 insertions, 36 deletions
diff --git a/src/Entities/ArrowEntity.cpp b/src/Entities/ArrowEntity.cpp
index 2db0baad6..0fc0f095d 100644
--- a/src/Entities/ArrowEntity.cpp
+++ b/src/Entities/ArrowEntity.cpp
@@ -25,9 +25,8 @@ cArrowEntity::cArrowEntity(cEntity * a_Creator, double a_X, double a_Y, double a
SetAirDrag(0.2f);
SetYawFromSpeed();
SetPitchFromSpeed();
- LOGD("Created arrow %d with speed {%.02f, %.02f, %.02f} and rot {%.02f, %.02f}",
- m_UniqueID, GetSpeedX(), GetSpeedY(), GetSpeedZ(),
- GetYaw(), GetPitch()
+ FLOGD("Created arrow {0} with speed {1:.02f} and rot {{{2:.02f}, {3:.02f}}}",
+ m_UniqueID, GetSpeed(), GetYaw(), GetPitch()
);
}
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp
index 4c9900aa9..c0c381d41 100644
--- a/src/Entities/Entity.cpp
+++ b/src/Entities/Entity.cpp
@@ -88,12 +88,12 @@ cEntity::~cEntity()
/*
// DEBUG:
- LOGD("Deleting entity %d at pos {%.2f, %.2f, %.2f} ~ [%d, %d]; ptr %p",
+ FLOGD("Deleting entity {0} at pos {1:.2f} ~ [{2}, {3}]; ptr {4}",
m_UniqueID,
- m_Pos.x, m_Pos.y, m_Pos.z,
- (int)(m_Pos.x / cChunkDef::Width), (int)(m_Pos.z / cChunkDef::Width),
- this
- );
+ m_Pos,
+ GetChunkX(), GetChunkZ(),
+ static_cast<void *>(this)
+ );
*/
if (m_AttachedTo != nullptr)
@@ -146,8 +146,8 @@ bool cEntity::Initialize(OwnedEntity a_Self, cWorld & a_EntityWorld)
/*
// DEBUG:
- LOGD("Initializing entity #%d (%s) at {%.02f, %.02f, %.02f}",
- m_UniqueID, GetClass(), m_Pos.x, m_Pos.y, m_Pos.z
+ FLOGD("Initializing entity #{0} ({1}) at {2:.02f}",
+ m_UniqueID, GetClass(), m_Pos
);
*/
@@ -992,8 +992,8 @@ void cEntity::HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
/*
// DEBUG:
- LOGD("Entity #%d (%s) is inside a block at {%d, %d, %d}",
- m_UniqueID, GetClass(), BlockX, BlockY, BlockZ
+ FLOGD("Entity #{0} ({1}) is inside a block at {{2}}",
+ m_UniqueID, GetClass(), Vector3i{BlockX, BlockY, BlockZ}
);
*/
}
diff --git a/src/Entities/FallingBlock.cpp b/src/Entities/FallingBlock.cpp
index cbbb97202..0e03d50ce 100644
--- a/src/Entities/FallingBlock.cpp
+++ b/src/Entities/FallingBlock.cpp
@@ -71,11 +71,11 @@ void cFallingBlock::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
// Fallen onto a solid block
/*
- LOGD(
- "Sand: Checked below at {%d, %d, %d} (rel {%d, %d, %d}), it's %s, finishing the fall.",
- BlockX, BlockY, BlockZ,
- BlockX - a_Chunk.GetPosX() * cChunkDef::Width, BlockY, BlockZ - a_Chunk.GetPosZ() * cChunkDef::Width,
- ItemTypeToString(BlockBelow).c_str()
+ FLOGD(
+ "Sand: Checked below at {0} (rel {1}), it's {2}, finishing the fall.",
+ Vector3i{BlockX, BlockY, BlockZ},
+ cChunkDef::AbsoluteToRelative({BlockX, BlockY, BlockZ}, {a_Chunk.GetPosX(), a_Chunk.GetPosZ()}),
+ ItemTypeToString(BlockBelow)
);
*/
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index cd1414adb..044b802b7 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -150,8 +150,8 @@ cPlayer::cPlayer(cClientHandlePtr a_Client, const AString & a_PlayerName) :
SetWorld(World); // Use default world
- LOGD("Player \"%s\" is connecting for the first time, spawning at default world spawn {%.2f, %.2f, %.2f}",
- a_PlayerName.c_str(), GetPosX(), GetPosY(), GetPosZ()
+ FLOGD("Player \"{0}\" is connecting for the first time, spawning at default world spawn {1:.2f}",
+ a_PlayerName, GetPosition()
);
}
@@ -2256,8 +2256,8 @@ bool cPlayer::LoadFromFile(const AString & a_FileName, cWorldPtr & a_World)
cStatSerializer StatSerializer(cRoot::Get()->GetDefaultWorld()->GetDataPath(), GetName(), GetUUID().ToLongString(), &m_Stats);
StatSerializer.Load();
- LOGD("Player %s was read from file \"%s\", spawning at {%.2f, %.2f, %.2f} in world \"%s\"",
- GetName().c_str(), a_FileName.c_str(), GetPosX(), GetPosY(), GetPosZ(), a_World->GetName().c_str()
+ FLOGD("Player {0} was read from file \"{1}\", spawning at {2:.2f} in world \"{3}\"",
+ GetName(), a_FileName, GetPosition(), a_World->GetName()
);
return true;
diff --git a/src/Entities/ProjectileEntity.cpp b/src/Entities/ProjectileEntity.cpp
index 915475f2a..4a5da0874 100644
--- a/src/Entities/ProjectileEntity.cpp
+++ b/src/Entities/ProjectileEntity.cpp
@@ -60,11 +60,11 @@ protected:
{
/*
// DEBUG:
- LOGD("Hit block %d:%d at {%d, %d, %d} face %d, %s (%s)",
+ FLOGD("Hit block {0}:{1} at {2} face {3}, {4} ({5})",
a_BlockType, a_BlockMeta,
- a_BlockX, a_BlockY, a_BlockZ, a_EntryFace,
+ Vector3i{a_BlockX, a_BlockY, a_BlockZ}, a_EntryFace,
cBlockInfo::IsSolid(a_BlockType) ? "solid" : "non-solid",
- ItemToString(cItem(a_BlockType, 1, a_BlockMeta)).c_str()
+ ItemToString(cItem(a_BlockType, 1, a_BlockMeta))
);
*/
@@ -306,10 +306,8 @@ void cProjectileEntity::OnHitSolidBlock(Vector3d a_HitPos, eBlockFace a_HitFace)
SetSpeed(0, 0, 0);
// DEBUG:
- LOGD("Projectile %d: pos {%.02f, %.02f, %.02f}, hit solid block at face %d",
- m_UniqueID,
- a_HitPos.x, a_HitPos.y, a_HitPos.z,
- a_HitFace
+ FLOGD("Projectile {0}: pos {1:.02f}, hit solid block at face {2}",
+ m_UniqueID, a_HitPos, a_HitFace
);
m_IsInGround = true;
@@ -401,11 +399,11 @@ void cProjectileEntity::HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a
Vector3d HitPos = Pos + (NextPos - Pos) * EntityCollisionCallback.GetMinCoeff();
// DEBUG:
- LOGD("Projectile %d has hit an entity %d (%s) at {%.02f, %.02f, %.02f} (coeff %.03f)",
+ FLOGD("Projectile {0} has hit an entity {1} ({2}) at {3:.02f} (coeff {4:.03f})",
m_UniqueID,
EntityCollisionCallback.GetHitEntity()->GetUniqueID(),
EntityCollisionCallback.GetHitEntity()->GetClass(),
- HitPos.x, HitPos.y, HitPos.z,
+ HitPos,
EntityCollisionCallback.GetMinCoeff()
);
@@ -438,11 +436,8 @@ void cProjectileEntity::HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a
SetPitchFromSpeed();
/*
- LOGD("Projectile %d: pos {%.02f, %.02f, %.02f}, speed {%.02f, %.02f, %.02f}, rot {%.02f, %.02f}",
- m_UniqueID,
- GetPosX(), GetPosY(), GetPosZ(),
- GetSpeedX(), GetSpeedY(), GetSpeedZ(),
- GetYaw(), GetPitch()
+ FLOGD("Projectile {0}: pos {1:.02f}, speed {2:.02f}, rot {{{3:.02f}, {4:.02f}}}",
+ m_UniqueID, GetPos(), GetSpeed(), GetYaw(), GetPitch()
);
*/
}
diff --git a/src/Entities/TNTEntity.cpp b/src/Entities/TNTEntity.cpp
index f83384649..640684ace 100644
--- a/src/Entities/TNTEntity.cpp
+++ b/src/Entities/TNTEntity.cpp
@@ -35,7 +35,7 @@ void cTNTEntity::Explode(void)
{
m_FuseTicks = 0;
Destroy(true);
- LOGD("BOOM at {%f, %f, %f}", GetPosX(), GetPosY(), GetPosZ());
+ FLOGD("BOOM at {0}", GetPosition());
m_World->DoExplosionAt(4.0, GetPosX() + 0.49, GetPosY() + 0.49, GetPosZ() + 0.49, true, esPrimedTNT, this);
}