diff options
Diffstat (limited to 'src/Simulator/FireSimulator.cpp')
-rw-r--r-- | src/Simulator/FireSimulator.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/Simulator/FireSimulator.cpp b/src/Simulator/FireSimulator.cpp index 30fe88acd..67a00f241 100644 --- a/src/Simulator/FireSimulator.cpp +++ b/src/Simulator/FireSimulator.cpp @@ -87,7 +87,6 @@ void cFireSimulator::SimulateChunk(std::chrono::milliseconds a_Dt, int a_ChunkX, for (cCoordWithIntList::iterator itr = Data.begin(); itr != Data.end();) { Vector3i relPos(itr->x, itr->y, itr->z); - auto absPos = a_Chunk->RelativeToAbsolute(relPos); auto blockType = a_Chunk->GetBlock(relPos); if (!IsAllowedBlock(blockType)) @@ -101,12 +100,16 @@ void cFireSimulator::SimulateChunk(std::chrono::milliseconds a_Dt, int a_ChunkX, auto BurnsForever = ((relPos.y > 0) && DoesBurnForever(a_Chunk->GetBlock(relPos.addedY(-1)))); auto BlockMeta = a_Chunk->GetMeta(relPos); - auto Raining = std::any_of(std::begin(gCrossCoords), std::end(gCrossCoords), - [this, absPos](Vector3i cc) + auto Raining = std::any_of(std::begin(gCrossCoords), std::end(gCrossCoords), [a_Chunk, relPos](Vector3i cc) + { + auto Adjusted = relPos + cc; + const auto Chunk = a_Chunk->GetRelNeighborChunkAdjustCoords(Adjusted); + if ((Chunk != nullptr) && Chunk->IsValid()) { - return (m_World.IsWeatherWetAtXYZ(absPos + cc)); + return Chunk->IsWeatherWetAt(Adjusted); } - ); + return false; + }); // Randomly burn out the fire if it is raining: if (!BurnsForever && Raining && GetRandomProvider().RandBool(CHANCE_BASE_RAIN_EXTINGUISH + (BlockMeta * CHANCE_AGE_M_RAIN_EXTINGUISH))) |