summaryrefslogtreecommitdiffstats
path: root/src/Simulator
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2013-12-06 21:33:48 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2013-12-06 21:33:48 +0100
commit126577214acb1f3f1eb5c99062ddbed3cf1f3756 (patch)
tree9bd1815b5a59fd51113c26834bd08bfda1395253 /src/Simulator
parentFixed eating using wrong animation (diff)
downloadcuberite-126577214acb1f3f1eb5c99062ddbed3cf1f3756.tar
cuberite-126577214acb1f3f1eb5c99062ddbed3cf1f3756.tar.gz
cuberite-126577214acb1f3f1eb5c99062ddbed3cf1f3756.tar.bz2
cuberite-126577214acb1f3f1eb5c99062ddbed3cf1f3756.tar.lz
cuberite-126577214acb1f3f1eb5c99062ddbed3cf1f3756.tar.xz
cuberite-126577214acb1f3f1eb5c99062ddbed3cf1f3756.tar.zst
cuberite-126577214acb1f3f1eb5c99062ddbed3cf1f3756.zip
Diffstat (limited to 'src/Simulator')
-rw-r--r--src/Simulator/RedstoneSimulator.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/Simulator/RedstoneSimulator.cpp b/src/Simulator/RedstoneSimulator.cpp
index 9fdbd1151..fef3e8b21 100644
--- a/src/Simulator/RedstoneSimulator.cpp
+++ b/src/Simulator/RedstoneSimulator.cpp
@@ -1165,6 +1165,20 @@ void cRedstoneSimulator::SetBlockPowered(int a_BlockX, int a_BlockY, int a_Block
return;
}
+ for (PoweredBlocksList::iterator itr = m_PoweredBlocks.begin(); itr != m_PoweredBlocks.end(); ++itr) // Check powered list
+ {
+ sPoweredBlocks & Change = *itr;
+
+ if (
+ Change.a_BlockPos.Equals(Vector3i(a_BlockX, a_BlockY, a_BlockZ)) &&
+ Change.a_SourcePos.Equals(Vector3i(a_SourceX, a_SourceY, a_SourceZ))
+ )
+ {
+ // Check for duplicates
+ return;
+ }
+ }
+
sPoweredBlocks RC;
RC.a_BlockPos = Vector3i(a_BlockX, a_BlockY, a_BlockZ);
RC.a_SourcePos = Vector3i(a_SourceX, a_SourceY, a_SourceZ);
@@ -1194,6 +1208,21 @@ void cRedstoneSimulator::SetBlockLinkedPowered(
return;
}
+ for (LinkedBlocksList::iterator itr = m_LinkedPoweredBlocks.begin(); itr != m_LinkedPoweredBlocks.end(); ++itr) // Check linked powered list
+ {
+ sLinkedPoweredBlocks & Change = *itr;
+
+ if (
+ Change.a_BlockPos.Equals(Vector3i(a_BlockX, a_BlockY, a_BlockZ)) &&
+ Change.a_MiddlePos.Equals(Vector3i(a_MiddleX, a_MiddleY, a_MiddleZ)) &&
+ Change.a_SourcePos.Equals(Vector3i(a_SourceX, a_SourceY, a_SourceZ))
+ )
+ {
+ // Check for duplicates
+ return;
+ }
+ }
+
sLinkedPoweredBlocks RC;
RC.a_BlockPos = Vector3i(a_BlockX, a_BlockY, a_BlockZ);
RC.a_MiddlePos = Vector3i(a_MiddleX, a_MiddleY, a_MiddleZ);