summaryrefslogtreecommitdiffstats
path: root/src/Simulator
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2013-12-15 13:17:29 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2013-12-15 13:17:29 +0100
commitceb11cb47752bc7dffedb646df86e9efd0d6ea16 (patch)
treea0c249795e96160001731df92d239d70e18dff21 /src/Simulator
parentPotentially fixed debug asserts (diff)
downloadcuberite-ceb11cb47752bc7dffedb646df86e9efd0d6ea16.tar
cuberite-ceb11cb47752bc7dffedb646df86e9efd0d6ea16.tar.gz
cuberite-ceb11cb47752bc7dffedb646df86e9efd0d6ea16.tar.bz2
cuberite-ceb11cb47752bc7dffedb646df86e9efd0d6ea16.tar.lz
cuberite-ceb11cb47752bc7dffedb646df86e9efd0d6ea16.tar.xz
cuberite-ceb11cb47752bc7dffedb646df86e9efd0d6ea16.tar.zst
cuberite-ceb11cb47752bc7dffedb646df86e9efd0d6ea16.zip
Diffstat (limited to 'src/Simulator')
-rw-r--r--src/Simulator/RedstoneSimulator.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/Simulator/RedstoneSimulator.cpp b/src/Simulator/RedstoneSimulator.cpp
index fc9471b91..baeef404c 100644
--- a/src/Simulator/RedstoneSimulator.cpp
+++ b/src/Simulator/RedstoneSimulator.cpp
@@ -82,10 +82,16 @@ void cRedstoneSimulator::SimulateChunk(float a_Dt, int a_ChunkX, int a_ChunkZ, c
{
int RelX = itr->a_SourcePos.x - a_ChunkX * cChunkDef::Width;
int RelZ = itr->a_SourcePos.z - a_ChunkZ * cChunkDef::Width;
+ int DestRelX = itr->a_BlockPos.x - a_ChunkX * cChunkDef::Width;
+ int DestRelZ = itr->a_BlockPos.z - a_ChunkZ * cChunkDef::Width;
BLOCKTYPE SourceBlockType;
NIBBLETYPE SourceBlockMeta;
- if (!a_Chunk->UnboundedRelGetBlock(RelX, itr->a_SourcePos.y, RelZ, SourceBlockType, SourceBlockMeta))
+ BLOCKTYPE DestBlockType;
+ if (
+ !a_Chunk->UnboundedRelGetBlock(RelX, itr->a_SourcePos.y, RelZ, SourceBlockType, SourceBlockMeta) ||
+ !a_Chunk->UnboundedRelGetBlockType(DestRelX, itr->a_SourcePos.y, DestRelZ, DestBlockType)
+ )
{
continue;
}
@@ -106,6 +112,12 @@ void cRedstoneSimulator::SimulateChunk(float a_Dt, int a_ChunkX, int a_ChunkZ, c
LOGD("cRedstoneSimulator: Erased block %s from powered blocks list due to present/past metadata mismatch", ItemToFullString(itr->a_SourceBlock).c_str());
itr = m_PoweredBlocks.erase(itr);
}
+ else if ((SourceBlockType == E_BLOCK_REDSTONE_WIRE) && (DestBlockType == E_BLOCK_REDSTONE_WIRE))
+ {
+ // It is simply not allowed that a wire powers another wire, presuming that data here is sane and a dest and source are beside each other
+ LOGD("cRedstoneSimulator: Erased redstone wire from powered blocks list because it's source was also wire");
+ itr = m_PoweredBlocks.erase(itr);
+ }
else
{
itr++;