1
0

Add a formatting function for Vector3 (#4282)

* Vector3: Add custom fmt compatible formatter.

* cLuaState: Add fmt version of ApiParamError

* Use vector formatting in manual bindings

* Always log vectors with FLOG
This commit is contained in:
peterbell10
2018-09-24 21:33:39 +01:00
committed by Alexander Harkness
parent 73689024f0
commit 4727ed2084
27 changed files with 192 additions and 181 deletions

View File

@@ -1059,8 +1059,8 @@ void cClientHandle::HandleAnvilItemName(const AString & a_ItemName)
void cClientHandle::HandleLeftClick(int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, UInt8 a_Status)
{
LOGD("HandleLeftClick: {%i, %i, %i}; Face: %i; Stat: %i",
a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_Status
FLOGD("HandleLeftClick: {0}; Face: {1}; Stat: {2}",
Vector3i{a_BlockX, a_BlockY, a_BlockZ}, a_BlockFace, a_Status
);
m_NumBlockChangeInteractionsThisTick++;
@@ -1298,9 +1298,9 @@ void cClientHandle::HandleBlockDigFinished(int a_BlockX, int a_BlockY, int a_Blo
(m_LastDigBlockZ != a_BlockZ)
)
{
LOGD("Prevented a dig / aim bug in the client (finish {%d, %d, %d} vs start {%d, %d, %d}, HSD: %s)",
a_BlockX, a_BlockY, a_BlockZ,
m_LastDigBlockX, m_LastDigBlockY, m_LastDigBlockZ,
FLOGD("Prevented a dig / aim bug in the client (finish {0} vs start {1}, HSD: {2})",
Vector3i{a_BlockX, a_BlockY, a_BlockZ},
Vector3i{m_LastDigBlockX, m_LastDigBlockY, m_LastDigBlockZ},
(m_HasStartedDigging ? "True" : "False")
);
return;
@@ -1424,8 +1424,8 @@ void cClientHandle::HandleRightClick(int a_BlockX, int a_BlockY, int a_BlockZ, e
// TODO: This distance should be calculated from the point that the cursor pointing at, instead of the center of the block
// Distance from the block's center to the player's eye height
double Dist = (Vector3d(a_BlockX, a_BlockY, a_BlockZ) + Vector3d(0.5, 0.5, 0.5) - m_Player->GetEyePosition()).Length();
LOGD("HandleRightClick: {%d, %d, %d}, face %d, Hand: %d, HeldItem: %s; Dist: %.02f",
a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_Hand, ItemToFullString(HeldItem).c_str(), Dist
FLOGD("HandleRightClick: {0}, face {1}, Hand: {2}, HeldItem: {3}; Dist: {4:.02f}",
Vector3i{a_BlockX, a_BlockY, a_BlockZ}, a_BlockFace, a_Hand, ItemToFullString(HeldItem), Dist
);
// Check the reach distance:
@@ -2789,8 +2789,8 @@ void cClientHandle::SendPlayerMaxSpeed(void)
void cClientHandle::SendPlayerMoveLook(void)
{
/*
LOGD("Sending PlayerMoveLook: {%0.2f, %0.2f, %0.2f}, stance %0.2f, OnGround: %d",
m_Player->GetPosX(), m_Player->GetPosY(), m_Player->GetPosZ(), m_Player->GetStance(), m_Player->IsOnGround() ? 1 : 0
FLOGD("Sending PlayerMoveLook: {0:0.2f}, stance {1:0.2f}, OnGround: {2}",
m_Player->GetPosition(), m_Player->GetStance(), m_Player->IsOnGround()
);
*/
m_Protocol->SendPlayerMoveLook();