diff options
author | Tiger Wang <ziwei.tiger@outlook.com> | 2021-01-05 03:13:02 +0100 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@outlook.com> | 2021-01-11 17:39:56 +0100 |
commit | 9328afe65c72b29f5cedbf1897ea8559f6b2c42f (patch) | |
tree | 92d9490d062009278ed8d78f8981014e88ba8f05 /src/Simulator | |
parent | zlib -> libdeflate (#5085) (diff) | |
download | cuberite-9328afe65c72b29f5cedbf1897ea8559f6b2c42f.tar cuberite-9328afe65c72b29f5cedbf1897ea8559f6b2c42f.tar.gz cuberite-9328afe65c72b29f5cedbf1897ea8559f6b2c42f.tar.bz2 cuberite-9328afe65c72b29f5cedbf1897ea8559f6b2c42f.tar.lz cuberite-9328afe65c72b29f5cedbf1897ea8559f6b2c42f.tar.xz cuberite-9328afe65c72b29f5cedbf1897ea8559f6b2c42f.tar.zst cuberite-9328afe65c72b29f5cedbf1897ea8559f6b2c42f.zip |
Diffstat (limited to '')
-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))) |