From 4727ed20846bb3d1a9eabb27aaaa9c5524129556 Mon Sep 17 00:00:00 2001 From: peterbell10 Date: Mon, 24 Sep 2018 21:33:39 +0100 Subject: 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 --- src/BlockEntities/HopperEntity.cpp | 12 ++++++------ src/BlockEntities/MobSpawnerEntity.cpp | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/BlockEntities') diff --git a/src/BlockEntities/HopperEntity.cpp b/src/BlockEntities/HopperEntity.cpp index 91340f35b..6eb5f961d 100644 --- a/src/BlockEntities/HopperEntity.cpp +++ b/src/BlockEntities/HopperEntity.cpp @@ -334,7 +334,7 @@ bool cHopperEntity::MoveItemsOut(cChunk & a_Chunk, Int64 a_CurrentTick) cBlockEntityWithItems * BlockEntity = static_cast(DestChunk->GetBlockEntity(OutX, OutY, OutZ)); if (BlockEntity == nullptr) { - LOGWARNING("%s: A block entity was not found where expected at {%d, %d, %d}", __FUNCTION__, OutX, OutY, OutZ); + FLOGWARNING("{0}: A block entity was not found where expected at {1}", __FUNCTION__, Vector3i{OutX, OutY, OutZ}); return false; } res = MoveItemsToGrid(*BlockEntity); @@ -360,7 +360,7 @@ bool cHopperEntity::MoveItemsFromChest(cChunk & a_Chunk) cChestEntity * MainChest = static_cast(a_Chunk.GetBlockEntity(m_PosX, m_PosY + 1, m_PosZ)); if (MainChest == nullptr) { - LOGWARNING("%s: A chest entity was not found where expected, at {%d, %d, %d}", __FUNCTION__, m_PosX, m_PosY + 1, m_PosZ); + FLOGWARNING("{0}: A chest entity was not found where expected, at {1}", __FUNCTION__, GetPos() + Vector3i{0, 1, 0}); return false; } if (MoveItemsFromGrid(*MainChest)) @@ -401,7 +401,7 @@ bool cHopperEntity::MoveItemsFromChest(cChunk & a_Chunk) cChestEntity * SideChest = static_cast(Neighbor->GetBlockEntity(m_PosX + Coords[i].x, m_PosY + 1, m_PosZ + Coords[i].z)); if (SideChest == nullptr) { - LOGWARNING("%s: A chest entity was not found where expected, at {%d, %d, %d}", __FUNCTION__, m_PosX + Coords[i].x, m_PosY + 1, m_PosZ + Coords[i].z); + FLOGWARNING("{0}: A chest entity was not found where expected, at {1}", __FUNCTION__, GetPos() + Vector3i{Coords[i].x, 1, Coords[i].z}); } else { @@ -426,7 +426,7 @@ bool cHopperEntity::MoveItemsFromFurnace(cChunk & a_Chunk) cFurnaceEntity * Furnace = static_cast(a_Chunk.GetBlockEntity(m_PosX, m_PosY + 1, m_PosZ)); if (Furnace == nullptr) { - LOGWARNING("%s: A furnace entity was not found where expected, at {%d, %d, %d}", __FUNCTION__, m_PosX, m_PosY + 1, m_PosZ); + FLOGWARNING("{0}: A furnace entity was not found where expected, at {1}", __FUNCTION__, GetPos() + Vector3i{0, 1, 0}); return false; } @@ -527,7 +527,7 @@ bool cHopperEntity::MoveItemsToChest(cChunk & a_Chunk, int a_BlockX, int a_Block cChestEntity * ConnectedChest = static_cast(a_Chunk.GetBlockEntity(a_BlockX, a_BlockY, a_BlockZ)); if (ConnectedChest == nullptr) { - LOGWARNING("%s: A chest entity was not found where expected, at {%d, %d, %d}", __FUNCTION__, a_BlockX, a_BlockY, a_BlockZ); + FLOGWARNING("{0}: A chest entity was not found where expected, at {1}", __FUNCTION__, Vector3i{a_BlockX, a_BlockY, a_BlockZ}); return false; } if (MoveItemsToGrid(*ConnectedChest)) @@ -570,7 +570,7 @@ bool cHopperEntity::MoveItemsToChest(cChunk & a_Chunk, int a_BlockX, int a_Block cChestEntity * Chest = static_cast(Neighbor->GetBlockEntity(a_BlockX + Coords[i].x, a_BlockY, a_BlockZ + Coords[i].z)); if (Chest == nullptr) { - LOGWARNING("%s: A chest entity was not found where expected, at {%d, %d, %d} (%d, %d)", __FUNCTION__, a_BlockX + Coords[i].x, a_BlockY, a_BlockZ + Coords[i].z, x, z); + FLOGWARNING("{0}: A chest entity was not found where expected, at {1} ({2}, {3}})", __FUNCTION__, Vector3i{a_BlockX + Coords[i].x, a_BlockY, a_BlockZ + Coords[i].z}, x, z); continue; } if (MoveItemsToGrid(*Chest)) diff --git a/src/BlockEntities/MobSpawnerEntity.cpp b/src/BlockEntities/MobSpawnerEntity.cpp index b92139025..595f433b7 100644 --- a/src/BlockEntities/MobSpawnerEntity.cpp +++ b/src/BlockEntities/MobSpawnerEntity.cpp @@ -64,7 +64,7 @@ bool cMobSpawnerEntity::UsedBy(cPlayer * a_Player) { a_Player->GetInventory().RemoveOneEquippedItem(); } - LOGD("Changed monster spawner at {%d, %d, %d} to type %s.", GetPosX(), GetPosY(), GetPosZ(), cMonster::MobTypeToString(MonsterType).c_str()); + FLOGD("Changed monster spawner at {0} to type {1}.", GetPos(), cMonster::MobTypeToString(MonsterType)); return true; } return false; -- cgit v1.2.3