summaryrefslogtreecommitdiffstats
path: root/source/cRedstone.cpp
diff options
context:
space:
mode:
authoradmin@omencraft.com <admin@omencraft.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-11-04 08:50:18 +0100
committeradmin@omencraft.com <admin@omencraft.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-11-04 08:50:18 +0100
commit2ffedf16aeb95dda3771fded0db98c9825e79b3b (patch)
treeb0dba4ab84131b084b365787040a150050e2fbe4 /source/cRedstone.cpp
parentceleaning up the mess I made of cRedstone.h. >.> (diff)
downloadcuberite-2ffedf16aeb95dda3771fded0db98c9825e79b3b.tar
cuberite-2ffedf16aeb95dda3771fded0db98c9825e79b3b.tar.gz
cuberite-2ffedf16aeb95dda3771fded0db98c9825e79b3b.tar.bz2
cuberite-2ffedf16aeb95dda3771fded0db98c9825e79b3b.tar.lz
cuberite-2ffedf16aeb95dda3771fded0db98c9825e79b3b.tar.xz
cuberite-2ffedf16aeb95dda3771fded0db98c9825e79b3b.tar.zst
cuberite-2ffedf16aeb95dda3771fded0db98c9825e79b3b.zip
Diffstat (limited to 'source/cRedstone.cpp')
-rw-r--r--source/cRedstone.cpp33
1 files changed, 19 insertions, 14 deletions
diff --git a/source/cRedstone.cpp b/source/cRedstone.cpp
index 619ead615..87f1f23f1 100644
--- a/source/cRedstone.cpp
+++ b/source/cRedstone.cpp
@@ -1,4 +1,5 @@
#include "cRedstone.h"
+#include "cRoot.h"
#include "cWorld.h"
@@ -16,50 +17,54 @@ void cRedstone::ChangeRedstoneTorch( int fillx, int filly, int fillz, bool added
} else {
metadata = 0;
}
- if ( ( m_World->GetWorld()->GetBlock( fillx+1, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) ) {
+
+ cWorld* World = cRoot::Get()->GetWorld();
+
+ if ( ( (int)World->GetBlock( fillx+1, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) ) {
LightRedstone( fillx+1, filly, fillz, metadata );
}
- if ( ((int)m_World->GetWorld()->GetBlock( fillx-1, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) ) {
+ if ( ( (int)World->GetBlock( fillx-1, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) ) {
LightRedstone( fillx-1, filly, fillz, metadata );
}
- if ( ((int)m_World->GetWorld()->GetBlock( fillx, filly, fillz+1 ) == E_BLOCK_REDSTONE_WIRE) ) {
+ if ( ( (int)World->GetBlock( fillx, filly, fillz+1 ) == E_BLOCK_REDSTONE_WIRE) ) {
LightRedstone( fillx, filly, fillz+1, metadata );
}
- if ( ((int)m_World->GetWorld()->GetBlock( fillx, filly, fillz-1 ) == E_BLOCK_REDSTONE_WIRE) ) {
+ if ( ( (int)World->GetBlock( fillx, filly, fillz-1 ) == E_BLOCK_REDSTONE_WIRE) ) {
LightRedstone( fillx, filly, fillz-1, metadata );
}
- if ( ((int)m_World->GetWorld()->GetBlock( fillx+1, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) ) {
+ if ( ( (int)World->GetBlock( fillx+1, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) ) {
LightRedstone( fillx+1, filly-1, fillz, metadata );
}
- if ( ((int)m_World->GetWorld()->GetBlock( fillx-1, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) ) {
+ if ( ( (int)World->GetBlock( fillx-1, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) ) {
LightRedstone( fillx-1, filly-1, fillz, metadata );
}
- if ( ((int)m_World->GetWorld()->GetBlock( fillx, filly, fillz+1 ) == E_BLOCK_REDSTONE_WIRE) ) {
+ if ( ( (int)World->GetBlock( fillx, filly, fillz+1 ) == E_BLOCK_REDSTONE_WIRE) ) {
LightRedstone( fillx, filly-1, fillz+1, metadata );
}
- if ( ((int)m_World->GetWorld()->GetBlock( fillx, filly, fillz-1 ) == E_BLOCK_REDSTONE_WIRE) ) {
+ if ( ( (int)World->GetBlock( fillx, filly, fillz-1 ) == E_BLOCK_REDSTONE_WIRE) ) {
LightRedstone( fillx, filly-1, fillz-1, metadata );
}
- if ( ((int)m_World->GetWorld()->GetBlock( fillx+1, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) ) {
+ if ( ( (int)World->GetBlock( fillx+1, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) ) {
LightRedstone( fillx+1, filly+1, fillz, metadata );
}
- if ( ((int)m_World->GetWorld()->GetBlock( fillx-1, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) ) {
+ if ( ( (int)World->GetBlock( fillx-1, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) ) {
LightRedstone( fillx-1, filly+1, fillz, metadata );
}
- if ( ((int)m_World->GetWorld()->GetBlock( fillx, filly, fillz+1 ) == E_BLOCK_REDSTONE_WIRE) ) {
+ if ( ( (int)World->GetBlock( fillx, filly, fillz+1 ) == E_BLOCK_REDSTONE_WIRE) ) {
LightRedstone( fillx, filly+1, fillz+1, metadata );
}
- if ( ((int)m_World->GetWorld()->GetBlock( fillx, filly, fillz-1 ) == E_BLOCK_REDSTONE_WIRE) ) {
+ if ( ( (int)World->GetBlock( fillx, filly, fillz-1 ) == E_BLOCK_REDSTONE_WIRE) ) {
LightRedstone( fillx, filly+1, fillz-1, metadata );
}
}
void cRedstone::LightRedstone( int fillx, int filly, int fillz, char metadata)
{
- if ( ( (int)m_World->GetWorld()->GetBlock( fillx, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) && ( (int)m_World->GetWorld()->GetBlockMeta( fillx, filly, fillz) != metadata ) ) {
- m_World->GetWorld()->SetBlock( fillx, filly, fillz, (char)E_BLOCK_REDSTONE_WIRE, metadata );
+ cWorld* World = cRoot::Get()->GetWorld();
+ if ( ( (int)World->GetBlock( fillx, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) && ( (int)World->GetBlockMeta( fillx, filly, fillz) != metadata ) ) {
+ World->SetBlock( fillx, filly, fillz, (char)E_BLOCK_REDSTONE_WIRE, metadata );
LightRedstone(fillx-1,filly,fillz,metadata);
LightRedstone(fillx+1,filly,fillz,metadata);
LightRedstone(fillx,filly,fillz-1,metadata);