summaryrefslogtreecommitdiffstats
path: root/src/Simulator/FireSimulator.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-03-12 07:39:39 +0100
committermadmaxoft <github@xoft.cz>2014-03-12 07:39:39 +0100
commit3e9f265a368fad0f8097ec68681853e0859ea240 (patch)
treecd24727b0ff02d104eee23f44e92174aec977054 /src/Simulator/FireSimulator.cpp
parentFixed APIDump (diff)
parentMerge pull request #791 from mc-server/PieceGenerator (diff)
downloadcuberite-3e9f265a368fad0f8097ec68681853e0859ea240.tar
cuberite-3e9f265a368fad0f8097ec68681853e0859ea240.tar.gz
cuberite-3e9f265a368fad0f8097ec68681853e0859ea240.tar.bz2
cuberite-3e9f265a368fad0f8097ec68681853e0859ea240.tar.lz
cuberite-3e9f265a368fad0f8097ec68681853e0859ea240.tar.xz
cuberite-3e9f265a368fad0f8097ec68681853e0859ea240.tar.zst
cuberite-3e9f265a368fad0f8097ec68681853e0859ea240.zip
Diffstat (limited to 'src/Simulator/FireSimulator.cpp')
-rw-r--r--src/Simulator/FireSimulator.cpp26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/Simulator/FireSimulator.cpp b/src/Simulator/FireSimulator.cpp
index 4967c83f9..26712e6e6 100644
--- a/src/Simulator/FireSimulator.cpp
+++ b/src/Simulator/FireSimulator.cpp
@@ -334,21 +334,33 @@ void cFireSimulator::RemoveFuelNeighbors(cChunk * a_Chunk, int a_RelX, int a_Rel
for (size_t i = 0; i < ARRAYCOUNT(gNeighborCoords); i++)
{
BLOCKTYPE BlockType;
- NIBBLETYPE BlockMeta;
- if (!a_Chunk->UnboundedRelGetBlock(a_RelX + gNeighborCoords[i].x, a_RelY + gNeighborCoords[i].y, a_RelZ + gNeighborCoords[i].z, BlockType, BlockMeta))
+ int X = a_RelX + gNeighborCoords[i].x;
+ int Z = a_RelZ + gNeighborCoords[i].z;
+
+ cChunkPtr Neighbour = a_Chunk->GetRelNeighborChunkAdjustCoords(X, Z);
+ if (Neighbour == NULL)
{
- // Neighbor not accessible, ignore it
continue;
}
+ BlockType = Neighbour->GetBlock(X, a_RelY + gCrossCoords[i].y, Z);
+
if (!IsFuel(BlockType))
{
continue;
}
+
+ if (BlockType == E_BLOCK_TNT)
+ {
+ int AbsX = X + Neighbour->GetPosX() * cChunkDef::Width;
+ int AbsZ = Z + Neighbour->GetPosZ() * cChunkDef::Width;
+
+ m_World.SpawnPrimedTNT(AbsX, a_RelY + gNeighborCoords[i].y, AbsZ, 0);
+ Neighbour->SetBlock(X, a_RelY + gNeighborCoords[i].y, Z, E_BLOCK_AIR, 0);
+ return;
+ }
+
bool ShouldReplaceFuel = (m_World.GetTickRandomNumber(MAX_CHANCE_REPLACE_FUEL) < m_ReplaceFuelChance);
- a_Chunk->UnboundedRelSetBlock(
- a_RelX + gNeighborCoords[i].x, a_RelY + gNeighborCoords[i].y, a_RelZ + gNeighborCoords[i].z,
- ShouldReplaceFuel ? E_BLOCK_FIRE : E_BLOCK_AIR, 0
- );
+ Neighbour->SetBlock(X, a_RelY + gNeighborCoords[i].y, Z, ShouldReplaceFuel ? E_BLOCK_FIRE : E_BLOCK_AIR, 0);
} // for i - Coords[]
}