summaryrefslogtreecommitdiffstats
path: root/src/Simulator/IncrementalRedstoneSimulator.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2015-03-20 23:30:20 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2015-06-06 13:21:18 +0200
commitbd484750856586bd2354be2aa6852a63fd102c1b (patch)
treea5df764903451c430ad32fde29df42effad5c4b5 /src/Simulator/IncrementalRedstoneSimulator.h
parentComparators (diff)
downloadcuberite-bd484750856586bd2354be2aa6852a63fd102c1b.tar
cuberite-bd484750856586bd2354be2aa6852a63fd102c1b.tar.gz
cuberite-bd484750856586bd2354be2aa6852a63fd102c1b.tar.bz2
cuberite-bd484750856586bd2354be2aa6852a63fd102c1b.tar.lz
cuberite-bd484750856586bd2354be2aa6852a63fd102c1b.tar.xz
cuberite-bd484750856586bd2354be2aa6852a63fd102c1b.tar.zst
cuberite-bd484750856586bd2354be2aa6852a63fd102c1b.zip
Diffstat (limited to '')
-rw-r--r--src/Simulator/IncrementalRedstoneSimulator.h19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/Simulator/IncrementalRedstoneSimulator.h b/src/Simulator/IncrementalRedstoneSimulator.h
index 65e3ff4af..903dbe82a 100644
--- a/src/Simulator/IncrementalRedstoneSimulator.h
+++ b/src/Simulator/IncrementalRedstoneSimulator.h
@@ -22,7 +22,8 @@ class cIncrementalRedstoneSimulator :
public:
cIncrementalRedstoneSimulator(cWorld & a_World)
- : cRedstoneSimulator(a_World)
+ : cRedstoneSimulator(a_World),
+ m_Chunk(nullptr)
{
}
@@ -209,7 +210,7 @@ private:
/** Removes a block from the Powered and LinkedPowered lists
Used for variable sources such as tripwire hooks, daylight sensors, and trapped chests
*/
- void SetSourceUnpowered(int a_RelSourceX, int a_RelSourceY, int a_RelSourceZ, cChunk * a_Chunk, bool a_IsFirstCall = true);
+ void SetSourceUnpowered(int a_RelSourceX, int a_RelSourceY, int a_RelSourceZ, cChunk * a_Chunk);
void SetInvalidMiddleBlock(int a_RelMiddleX, int a_RelMiddleY, int a_RelMiddleZ, cChunk * a_Chunk, bool a_IsFirstCall = true);
/** Returns if a coordinate is powered or linked powered */
@@ -384,14 +385,14 @@ private:
}
}
- inline static bool AreCoordsOnChunkBoundary(int a_BlockX, int a_BlockY, int a_BlockZ)
+ inline static Vector3i GetCoordinateAdjacentChunk(const Vector3i & a_BlockPos)
{
- return ( // Are we on a chunk boundary? +- 2 because of LinkedPowered blocks
- ((a_BlockX % cChunkDef::Width) <= 1) ||
- ((a_BlockX % cChunkDef::Width) >= 14) ||
- ((a_BlockZ % cChunkDef::Width) <= 1) ||
- ((a_BlockZ % cChunkDef::Width) >= 14)
- );
+ // Are we on a chunk boundary? +- 2 because of LinkedPowered blocks
+ if ((a_BlockPos.x % cChunkDef::Width) <= 1) { return{ -2, 0, 0 }; }
+ if ((a_BlockPos.x % cChunkDef::Width) >= 14) { return{ 2, 0, 0 }; }
+ if ((a_BlockPos.z % cChunkDef::Width) <= 1) { return{ 0, 0, -2 }; }
+ if ((a_BlockPos.z % cChunkDef::Width) >= 14) { return{ 0, 0, 2 }; }
+ return { 0, 0, 0 };
}
inline static Vector3i AdjustRelativeCoords(const Vector3i & a_RelPosition)