summaryrefslogtreecommitdiffstats
path: root/src/Simulator
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-03-18 21:49:08 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-03-18 21:49:08 +0100
commitb8fe024f9de9988b8aa2fc86a1d52b8dbf5712df (patch)
tree93afcc6d60f697fe59a12b4e67a780a0c7a3907e /src/Simulator
parentAdded levels of shrapnel (diff)
parentFixed chunkmap tree block replacing. (diff)
downloadcuberite-b8fe024f9de9988b8aa2fc86a1d52b8dbf5712df.tar
cuberite-b8fe024f9de9988b8aa2fc86a1d52b8dbf5712df.tar.gz
cuberite-b8fe024f9de9988b8aa2fc86a1d52b8dbf5712df.tar.bz2
cuberite-b8fe024f9de9988b8aa2fc86a1d52b8dbf5712df.tar.lz
cuberite-b8fe024f9de9988b8aa2fc86a1d52b8dbf5712df.tar.xz
cuberite-b8fe024f9de9988b8aa2fc86a1d52b8dbf5712df.tar.zst
cuberite-b8fe024f9de9988b8aa2fc86a1d52b8dbf5712df.zip
Diffstat (limited to 'src/Simulator')
-rw-r--r--src/Simulator/FireSimulator.cpp26
-rw-r--r--src/Simulator/IncrementalRedstoneSimulator.cpp2
-rw-r--r--src/Simulator/Simulator.cpp1
-rw-r--r--src/Simulator/Simulator.h2
4 files changed, 21 insertions, 10 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[]
}
diff --git a/src/Simulator/IncrementalRedstoneSimulator.cpp b/src/Simulator/IncrementalRedstoneSimulator.cpp
index bbc38259e..92659fab7 100644
--- a/src/Simulator/IncrementalRedstoneSimulator.cpp
+++ b/src/Simulator/IncrementalRedstoneSimulator.cpp
@@ -1062,7 +1062,7 @@ void cIncrementalRedstoneSimulator::HandlePressurePlate(int a_BlockX, int a_Bloc
{
Vector3f EntityPos = a_Entity->GetPosition();
Vector3f BlockPos(m_X + 0.5f, (float)m_Y, m_Z + 0.5f);
- float Distance = (EntityPos - BlockPos).Length();
+ double Distance = (EntityPos - BlockPos).Length();
if (Distance <= 0.7)
{
diff --git a/src/Simulator/Simulator.cpp b/src/Simulator/Simulator.cpp
index 06fd0f858..0739f0187 100644
--- a/src/Simulator/Simulator.cpp
+++ b/src/Simulator/Simulator.cpp
@@ -3,7 +3,6 @@
#include "Simulator.h"
#include "../World.h"
-#include "../Vector3i.h"
#include "../BlockID.h"
#include "../Defines.h"
#include "../Chunk.h"
diff --git a/src/Simulator/Simulator.h b/src/Simulator/Simulator.h
index a25b7f1b6..a2e2a5742 100644
--- a/src/Simulator/Simulator.h
+++ b/src/Simulator/Simulator.h
@@ -1,7 +1,7 @@
#pragma once
-#include "../Vector3i.h"
+#include "../Vector3.h"
#include "inifile/iniFile.h"