From 757231cc6e777b8f4717d1467ef7efa01c7fde15 Mon Sep 17 00:00:00 2001 From: peterbell10 Date: Wed, 3 Jan 2018 17:41:16 +0000 Subject: Add the fmt library (#4065) * Replaces AppendVPrintf with fmt::sprintf * fmt::ArgList now used as a type safe alternative to varargs. * Removed SIZE_T_FMT compatibility macros. fmt::sprintf is fully portable and supports %zu. * Adds FLOG functions to log with fmt's native formatting style. --- src/Simulator/FireSimulator.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/Simulator/FireSimulator.cpp') diff --git a/src/Simulator/FireSimulator.cpp b/src/Simulator/FireSimulator.cpp index ac7456b0a..927a7ae22 100644 --- a/src/Simulator/FireSimulator.cpp +++ b/src/Simulator/FireSimulator.cpp @@ -14,9 +14,9 @@ // Easy switch for turning on debugging logging: #if 0 - #define FLOG LOGD + #define FIRE_LOG LOGD #else - #define FLOG(...) + #define FIRE_LOG(...) #endif @@ -111,7 +111,7 @@ void cFireSimulator::SimulateChunk(std::chrono::milliseconds a_Dt, int a_ChunkX, if (!IsAllowedBlock(BlockType)) { // The block is no longer eligible (not a fire block anymore; a player probably placed a block over the fire) - FLOG("FS: Removing block {%d, %d, %d}", + FIRE_LOG("FS: Removing block {%d, %d, %d}", AbsPos.x, AbsPos.y, AbsPos.z ); itr = Data.erase(itr); @@ -148,14 +148,15 @@ void cFireSimulator::SimulateChunk(std::chrono::milliseconds a_Dt, int a_ChunkX, } /* - FLOG("FS: Fire at {%d, %d, %d} is stepping", + FIRE_LOG("FS: Fire at {%d, %d, %d} is stepping", itr->x + a_ChunkX * cChunkDef::Width, itr->y, itr->z + a_ChunkZ * cChunkDef::Width ); */ // Has the fire burnt out? if (BlockMeta == 0x0f) { - FLOG("FS: Fire at {%d, %d, %d} burnt out, removing the fire block", + // The fire burnt out completely + FIRE_LOG("FS: Fire at {%d, %d, %d} burnt out, removing the fire block", itr->x + a_ChunkX * cChunkDef::Width, itr->y, itr->z + a_ChunkZ * cChunkDef::Width ); a_Chunk->SetBlock(x, y, z, E_BLOCK_AIR, 0); @@ -271,7 +272,7 @@ void cFireSimulator::AddBlock(Vector3i a_Block, cChunk * a_Chunk) } } // for itr - ChunkData[] - FLOG("FS: Adding block {%d, %d, %d}", a_Block.x, a_Block.y, a_Block.z); + FIRE_LOG("FS: Adding block {%d, %d, %d}", a_Block.x, a_Block.y, a_Block.z); ChunkData.push_back(cCoordWithInt(RelX, a_Block.y, RelZ, 100)); } @@ -351,7 +352,7 @@ void cFireSimulator::TrySpreadFire(cChunk * a_Chunk, int a_RelX, int a_RelY, int // Start the fire in the neighbor {x, y, z} /* - FLOG("FS: Trying to start fire at {%d, %d, %d}.", + FIRE_LOG("FS: Trying to start fire at {%d, %d, %d}.", x + a_Chunk->GetPosX() * cChunkDef::Width, y, z + a_Chunk->GetPosZ() * cChunkDef::Width ); */ @@ -365,7 +366,7 @@ void cFireSimulator::TrySpreadFire(cChunk * a_Chunk, int a_RelX, int a_RelY, int return; } - FLOG("FS: Starting new fire at {%d, %d, %d}.", a_PosX, y, a_PosZ); + FIRE_LOG("FS: Starting new fire at {%d, %d, %d}.", a_PosX, y, a_PosZ); a_Chunk->UnboundedRelSetBlock(x, y, z, E_BLOCK_FIRE, 0); } } // for y -- cgit v1.2.3