summaryrefslogtreecommitdiffstats
path: root/source/Simulator/RedstoneSimulator.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2013-11-21 23:44:18 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2013-11-21 23:44:18 +0100
commit314884d9bbd5ec1edf0ec473a1c29b493964f955 (patch)
tree630ff13b87592467ff509a55ce694768f6c8779d /source/Simulator/RedstoneSimulator.h
parentMultiple bugfixes [SEE DESC] (diff)
downloadcuberite-314884d9bbd5ec1edf0ec473a1c29b493964f955.tar
cuberite-314884d9bbd5ec1edf0ec473a1c29b493964f955.tar.gz
cuberite-314884d9bbd5ec1edf0ec473a1c29b493964f955.tar.bz2
cuberite-314884d9bbd5ec1edf0ec473a1c29b493964f955.tar.lz
cuberite-314884d9bbd5ec1edf0ec473a1c29b493964f955.tar.xz
cuberite-314884d9bbd5ec1edf0ec473a1c29b493964f955.tar.zst
cuberite-314884d9bbd5ec1edf0ec473a1c29b493964f955.zip
Diffstat (limited to '')
-rw-r--r--source/Simulator/RedstoneSimulator.h27
1 files changed, 26 insertions, 1 deletions
diff --git a/source/Simulator/RedstoneSimulator.h b/source/Simulator/RedstoneSimulator.h
index ab88f51e2..10d87505c 100644
--- a/source/Simulator/RedstoneSimulator.h
+++ b/source/Simulator/RedstoneSimulator.h
@@ -106,7 +106,7 @@ private:
///<summary>Marks all blocks immediately surrounding a coordinate as powered</summary>
void SetAllDirsAsPowered(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_SourceBlock);
- ///<summary>Returns if a coordiante is powered or linked powered</summary>
+ ///<summary>Returns if a coordinate is powered or linked powered</summary>
bool AreCoordsPowered(int a_BlockX, int a_BlockY, int a_BlockZ);
///<summary>Returns if a repeater is powered</summary>
bool IsRepeaterPowered(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_Meta);
@@ -117,6 +117,29 @@ private:
bool IsButtonOn(NIBBLETYPE a_BlockMeta);
/* ============================== */
+ /* ====== Misc Functions ====== */
+
+ ///<summary>Returns if a block is viable to be the MiddleBlock of a SetLinkedPowered operation</summary>
+ inline static bool IsViableMiddleBlock(BLOCKTYPE Block)
+ {
+ if (!g_BlockIsSolid[Block]) { return false; }
+
+ switch (Block)
+ {
+ // Add SOLID but not viable middle blocks here
+ case E_BLOCK_REDSTONE_REPEATER_ON:
+ case E_BLOCK_REDSTONE_REPEATER_OFF:
+ {
+ return false;
+ }
+ default:
+ {
+ return true;
+ }
+ }
+ }
+
+ ///<summary>Returns if a block is a mechanism (something that accepts power and does something)</summary>
inline static bool IsMechanism(BLOCKTYPE Block)
{
switch (Block)
@@ -145,6 +168,7 @@ private:
}
}
+ ///<summary>Returns if a block has the potential to output power</summary>
inline static bool IsPotentialSource(BLOCKTYPE Block)
{
switch (Block)
@@ -167,6 +191,7 @@ private:
}
}
+ ///<summary>Returns if a block is any sort of redstone device</summary>
inline static bool IsRedstone(BLOCKTYPE Block)
{
switch (Block)