summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2013-12-25 15:12:48 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2013-12-25 15:12:48 +0100
commit1a02d94ed2ff0b7d948319c48905408dde9f9b35 (patch)
tree9f98e7f902ee0088618489eff783e96bc718f737
parentBraced up some code (diff)
downloadcuberite-1a02d94ed2ff0b7d948319c48905408dde9f9b35.tar
cuberite-1a02d94ed2ff0b7d948319c48905408dde9f9b35.tar.gz
cuberite-1a02d94ed2ff0b7d948319c48905408dde9f9b35.tar.bz2
cuberite-1a02d94ed2ff0b7d948319c48905408dde9f9b35.tar.lz
cuberite-1a02d94ed2ff0b7d948319c48905408dde9f9b35.tar.xz
cuberite-1a02d94ed2ff0b7d948319c48905408dde9f9b35.tar.zst
cuberite-1a02d94ed2ff0b7d948319c48905408dde9f9b35.zip
Diffstat (limited to '')
-rw-r--r--src/Blocks/BlockRail.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/Blocks/BlockRail.h b/src/Blocks/BlockRail.h
index 24a101652..55cadfa48 100644
--- a/src/Blocks/BlockRail.h
+++ b/src/Blocks/BlockRail.h
@@ -43,6 +43,40 @@ public:
}
+ virtual void OnPlaced(cWorld *a_World, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override
+ {
+ super::OnPlaced(a_World, a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta);
+
+ // Alert diagonal rails
+ OnNeighborChanged(a_World, a_BlockX + 1, a_BlockY + 1, a_BlockZ);
+ OnNeighborChanged(a_World, a_BlockX - 1, a_BlockY + 1, a_BlockZ);
+ OnNeighborChanged(a_World, a_BlockX, a_BlockY + 1, a_BlockZ + 1);
+ OnNeighborChanged(a_World, a_BlockX, a_BlockY + 1, a_BlockZ - 1);
+
+ OnNeighborChanged(a_World, a_BlockX + 1, a_BlockY - 1, a_BlockZ);
+ OnNeighborChanged(a_World, a_BlockX - 1, a_BlockY - 1, a_BlockZ);
+ OnNeighborChanged(a_World, a_BlockX, a_BlockY - 1, a_BlockZ + 1);
+ OnNeighborChanged(a_World, a_BlockX, a_BlockY - 1, a_BlockZ - 1);
+ }
+
+
+ virtual void OnDestroyed(cWorld *a_World, int a_BlockX, int a_BlockY, int a_BlockZ) override
+ {
+ super::OnDestroyed(a_World, a_BlockX, a_BlockY, a_BlockZ);
+
+ // Alert diagonal rails
+ OnNeighborChanged(a_World, a_BlockX + 1, a_BlockY + 1, a_BlockZ);
+ OnNeighborChanged(a_World, a_BlockX - 1, a_BlockY + 1, a_BlockZ);
+ OnNeighborChanged(a_World, a_BlockX, a_BlockY + 1, a_BlockZ + 1);
+ OnNeighborChanged(a_World, a_BlockX, a_BlockY + 1, a_BlockZ - 1);
+
+ OnNeighborChanged(a_World, a_BlockX + 1, a_BlockY - 1, a_BlockZ);
+ OnNeighborChanged(a_World, a_BlockX - 1, a_BlockY - 1, a_BlockZ);
+ OnNeighborChanged(a_World, a_BlockX, a_BlockY - 1, a_BlockZ + 1);
+ OnNeighborChanged(a_World, a_BlockX, a_BlockY - 1, a_BlockZ - 1);
+ }
+
+
virtual void OnNeighborChanged(cWorld *a_World, int a_BlockX, int a_BlockY, int a_BlockZ) override
{
NIBBLETYPE Meta = a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);