Convert most calls to blocking GetHeight/GetBiomeAt to direct chunk accesses
* Hopefully fixes #5094
This commit is contained in:
@@ -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)))
|
||||
|
||||
Reference in New Issue
Block a user