summaryrefslogtreecommitdiffstats
path: root/src/Simulator/IncrementalRedstoneSimulator.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2015-05-27 00:30:50 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2015-06-06 13:21:21 +0200
commit6a831c0b6fdf984f0cdf1d30995c9e602bdd41a5 (patch)
tree2504a73b7c7d9b72a5ab9d4f4be467f0a462bdaf /src/Simulator/IncrementalRedstoneSimulator.h
parentImproved wires and repeaters (diff)
downloadcuberite-6a831c0b6fdf984f0cdf1d30995c9e602bdd41a5.tar
cuberite-6a831c0b6fdf984f0cdf1d30995c9e602bdd41a5.tar.gz
cuberite-6a831c0b6fdf984f0cdf1d30995c9e602bdd41a5.tar.bz2
cuberite-6a831c0b6fdf984f0cdf1d30995c9e602bdd41a5.tar.lz
cuberite-6a831c0b6fdf984f0cdf1d30995c9e602bdd41a5.tar.xz
cuberite-6a831c0b6fdf984f0cdf1d30995c9e602bdd41a5.tar.zst
cuberite-6a831c0b6fdf984f0cdf1d30995c9e602bdd41a5.zip
Diffstat (limited to '')
-rw-r--r--src/Simulator/IncrementalRedstoneSimulator.h34
1 files changed, 3 insertions, 31 deletions
diff --git a/src/Simulator/IncrementalRedstoneSimulator.h b/src/Simulator/IncrementalRedstoneSimulator.h
index 5133f7caf..934a0eab9 100644
--- a/src/Simulator/IncrementalRedstoneSimulator.h
+++ b/src/Simulator/IncrementalRedstoneSimulator.h
@@ -214,10 +214,10 @@ private:
bool QueueRepeaterPowerChange(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ, NIBBLETYPE a_Meta, bool ShouldPowerOn);
/** Removes a block from the Powered and LinkedPowered lists
- Used for variable sources such as tripwire hooks, daylight sensors, and trapped chests
+ Recursively removes all blocks powered by the given one
*/
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);
+ void SetInvalidMiddleBlock(int a_RelMiddleX, int a_RelMiddleY, int a_RelMiddleZ, cChunk * a_Chunk);
/** Returns if a coordinate is powered or linked powered */
bool AreCoordsPowered(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ) { return AreCoordsDirectlyPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ, m_Chunk) || AreCoordsLinkedPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ, m_Chunk); }
@@ -414,35 +414,7 @@ private:
inline static Vector3i AdjustRelativeCoords(const Vector3i & a_RelPosition)
{
- if (
- (a_RelPosition.x >= 0) && (a_RelPosition.x < cChunkDef::Width) &&
- (a_RelPosition.z >= 0) && (a_RelPosition.z < cChunkDef::Width)
- )
- {
- return a_RelPosition;
- }
-
- Vector3i RelPos = a_RelPosition;
-
- // Request for a different chunk, calculate chunk offset:
- while (RelPos.x >= cChunkDef::Width)
- {
- RelPos.x -= cChunkDef::Width;
- }
- while (RelPos.x < 0)
- {
- RelPos.x += cChunkDef::Width;
- }
- while (RelPos.z >= cChunkDef::Width)
- {
- RelPos.z -= cChunkDef::Width;
- }
- while (RelPos.z < 0)
- {
- RelPos.z += cChunkDef::Width;
- }
-
- return RelPos;
+ return Vector3i((a_RelPosition.x % cChunkDef::Width + cChunkDef::Width) % cChunkDef::Width, a_RelPosition.y, (a_RelPosition.z % cChunkDef::Width + cChunkDef::Width) % cChunkDef::Width);
}
};