diff options
Diffstat (limited to 'src/Simulator')
-rw-r--r-- | src/Simulator/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/Simulator/FireSimulator.cpp | 17 | ||||
-rw-r--r-- | src/Simulator/FloodyFluidSimulator.cpp | 36 | ||||
-rw-r--r-- | src/Simulator/IncrementalRedstoneSimulator/CMakeLists.txt | 1 |
4 files changed, 29 insertions, 26 deletions
diff --git a/src/Simulator/CMakeLists.txt b/src/Simulator/CMakeLists.txt index 5a67dd026..ab17eebe3 100644 --- a/src/Simulator/CMakeLists.txt +++ b/src/Simulator/CMakeLists.txt @@ -31,4 +31,5 @@ SET (HDRS if(NOT MSVC) add_library(Simulator ${SRCS} ${HDRS}) + target_link_libraries(Simulator fmt::fmt) endif() 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 diff --git a/src/Simulator/FloodyFluidSimulator.cpp b/src/Simulator/FloodyFluidSimulator.cpp index 05b00c639..b5ded0c3e 100644 --- a/src/Simulator/FloodyFluidSimulator.cpp +++ b/src/Simulator/FloodyFluidSimulator.cpp @@ -20,9 +20,9 @@ // Enable or disable detailed logging #if 0 - #define FLOG LOGD + #define FLUID_LOG LOGD #else - #define FLOG(...) + #define FLUID_LOG(...) #endif @@ -49,7 +49,7 @@ cFloodyFluidSimulator::cFloodyFluidSimulator( void cFloodyFluidSimulator::SimulateBlock(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ) { - FLOG("Simulating block {%d, %d, %d}: block %d, meta %d", + FLUID_LOG("Simulating block {%d, %d, %d}: block %d, meta %d", a_Chunk->GetPosX() * cChunkDef::Width + a_RelX, a_RelY, a_Chunk->GetPosZ() * cChunkDef::Width + a_RelZ, a_Chunk->GetBlock(a_RelX, a_RelY, a_RelZ), a_Chunk->GetMeta(a_RelX, a_RelY, a_RelZ) @@ -61,7 +61,7 @@ void cFloodyFluidSimulator::SimulateBlock(cChunk * a_Chunk, int a_RelX, int a_Re if (!IsAnyFluidBlock(MyBlock)) { // Can happen - if a block is scheduled for simulating and gets replaced in the meantime. - FLOG(" BadBlockType exit"); + FLUID_LOG(" BadBlockType exit"); return; } @@ -79,7 +79,7 @@ void cFloodyFluidSimulator::SimulateBlock(cChunk * a_Chunk, int a_RelX, int a_Re { // Has no tributary, has been decreased (in CheckTributaries()), // no more processing needed (neighbors have been scheduled by the decrease) - FLOG(" CheckTributaries exit"); + FLUID_LOG(" CheckTributaries exit"); return; } } @@ -153,7 +153,7 @@ bool cFloodyFluidSimulator::CheckTributaries(cChunk * a_Chunk, int a_RelX, int a if (IsAnyFluidBlock(a_Chunk->GetBlock(a_RelX, a_RelY + 1, a_RelZ))) { // This block is fed from above, no more processing needed - FLOG(" Fed from above"); + FLUID_LOG(" Fed from above"); return false; } } @@ -179,7 +179,7 @@ bool cFloodyFluidSimulator::CheckTributaries(cChunk * a_Chunk, int a_RelX, int a if (IsAllowedBlock(BlockType) && IsHigherMeta(BlockMeta, a_MyMeta)) { // This block is fed, no more processing needed - FLOG(" Fed from {%d, %d, %d}, type %d, meta %d", + FLUID_LOG(" Fed from {%d, %d, %d}, type %d, meta %d", a_Chunk->GetPosX() * cChunkDef::Width + a_RelX + Coords[i].x, a_RelY, a_Chunk->GetPosZ() * cChunkDef::Width + a_RelZ + Coords[i].z, @@ -193,7 +193,7 @@ bool cFloodyFluidSimulator::CheckTributaries(cChunk * a_Chunk, int a_RelX, int a // Block is not fed, decrease by m_Falloff levels: if (a_MyMeta >= 8) { - FLOG(" Not fed and downwards, turning into non-downwards meta %d", m_Falloff); + FLUID_LOG(" Not fed and downwards, turning into non-downwards meta %d", m_Falloff); a_Chunk->SetBlock(a_RelX, a_RelY, a_RelZ, m_StationaryFluidBlock, m_Falloff); } else @@ -201,12 +201,12 @@ bool cFloodyFluidSimulator::CheckTributaries(cChunk * a_Chunk, int a_RelX, int a a_MyMeta += m_Falloff; if (a_MyMeta < 8) { - FLOG(" Not fed, decreasing from %d to %d", a_MyMeta - m_Falloff, a_MyMeta); + FLUID_LOG(" Not fed, decreasing from %d to %d", a_MyMeta - m_Falloff, a_MyMeta); a_Chunk->SetBlock(a_RelX, a_RelY, a_RelZ, m_StationaryFluidBlock, a_MyMeta); } else { - FLOG(" Not fed, meta %d, erasing altogether", a_MyMeta); + FLUID_LOG(" Not fed, meta %d, erasing altogether", a_MyMeta); a_Chunk->SetBlock(a_RelX, a_RelY, a_RelZ, E_BLOCK_AIR, 0); } } @@ -252,7 +252,7 @@ void cFloodyFluidSimulator::SpreadToNeighbor(cChunk * a_NearChunk, int a_RelX, i { // Lava flowing into water, change to stone / cobblestone based on direction: BLOCKTYPE NewBlock = (a_NewMeta == 8) ? E_BLOCK_STONE : E_BLOCK_COBBLESTONE; - FLOG(" Lava flowing into water, turning water at rel {%d, %d, %d} into stone", + FLUID_LOG(" Lava flowing into water, turning water at rel {%d, %d, %d} into stone", a_RelX, a_RelY, a_RelZ, ItemTypeToString(NewBlock).c_str() ); @@ -273,7 +273,7 @@ void cFloodyFluidSimulator::SpreadToNeighbor(cChunk * a_NearChunk, int a_RelX, i { // Water flowing into lava, change to cobblestone / obsidian based on dest block: BLOCKTYPE NewBlock = (BlockMeta == 0) ? E_BLOCK_OBSIDIAN : E_BLOCK_COBBLESTONE; - FLOG(" Water flowing into lava, turning lava at rel {%d, %d, %d} into %s", + FLUID_LOG(" Water flowing into lava, turning lava at rel {%d, %d, %d} into %s", a_RelX, a_RelY, a_RelZ, ItemTypeToString(NewBlock).c_str() ); a_NearChunk->SetBlock(a_RelX, a_RelY, a_RelZ, NewBlock, 0); @@ -319,7 +319,7 @@ void cFloodyFluidSimulator::SpreadToNeighbor(cChunk * a_NearChunk, int a_RelX, i } // if (CanWashAway) // Spread: - FLOG(" Spreading to {%d, %d, %d} with meta %d", BlockX, a_RelY, BlockZ, a_NewMeta); + FLUID_LOG(" Spreading to {%d, %d, %d} with meta %d", BlockX, a_RelY, BlockZ, a_NewMeta); a_NearChunk->SetBlock(a_RelX, a_RelY, a_RelZ, m_FluidBlock, a_NewMeta); m_World.GetSimulatorManager()->WakeUp({BlockX, a_RelY, BlockZ}, a_NearChunk); @@ -332,7 +332,7 @@ void cFloodyFluidSimulator::SpreadToNeighbor(cChunk * a_NearChunk, int a_RelX, i bool cFloodyFluidSimulator::CheckNeighborsForSource(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ) { - FLOG(" Checking neighbors for source creation"); + FLUID_LOG(" Checking neighbors for source creation"); static const Vector3i NeighborCoords[] = { @@ -355,21 +355,21 @@ bool cFloodyFluidSimulator::CheckNeighborsForSource(cChunk * a_Chunk, int a_RelX // Neighbor not available, skip it continue; } - // FLOG(" Neighbor at {%d, %d, %d}: %s", x, y, z, ItemToFullString(cItem(BlockType, 1, BlockMeta)).c_str()); + // FLUID_LOG(" Neighbor at {%d, %d, %d}: %s", x, y, z, ItemToFullString(cItem(BlockType, 1, BlockMeta)).c_str()); if ((BlockMeta == 0) && IsAnyFluidBlock(BlockType)) { NumNeeded--; - // FLOG(" Found a neighbor source at {%d, %d, %d}, NumNeeded := %d", x, y, z, NumNeeded); + // FLUID_LOG(" Found a neighbor source at {%d, %d, %d}, NumNeeded := %d", x, y, z, NumNeeded); if (NumNeeded == 0) { // Found enough, turn into a source and bail out - // FLOG(" Found enough neighbor sources, turning into a source"); + // FLUID_LOG(" Found enough neighbor sources, turning into a source"); a_Chunk->SetBlock(a_RelX, a_RelY, a_RelZ, m_FluidBlock, 0); return true; } } } - // FLOG(" Not enough neighbors for turning into a source, NumNeeded = %d", NumNeeded); + // FLUID_LOG(" Not enough neighbors for turning into a source, NumNeeded = %d", NumNeeded); return false; } diff --git a/src/Simulator/IncrementalRedstoneSimulator/CMakeLists.txt b/src/Simulator/IncrementalRedstoneSimulator/CMakeLists.txt index 99d87ce88..15da35db0 100644 --- a/src/Simulator/IncrementalRedstoneSimulator/CMakeLists.txt +++ b/src/Simulator/IncrementalRedstoneSimulator/CMakeLists.txt @@ -33,5 +33,6 @@ set (HDRS if(NOT MSVC) add_library(IncrementalRedstoneSimulator ${SRCS} ${HDRS}) + target_link_libraries(IncrementalRedstoneSimulator fmt::fmt) endif() |