summaryrefslogtreecommitdiff
path: root/BlockCondition.cpp
diff options
context:
space:
mode:
authorKris Parker2009-11-01 02:27:56 +0000
committerKris Parker2009-11-01 02:27:56 +0000
commitf9c232bb310636ceb376987bfe82add01070276b (patch)
tree294d613887428e79f6e671a634efd10d410e73e9 /BlockCondition.cpp
parent7f7a1265ef12d035629b59529a065bbd70689e7b (diff)
downloadstonesense-f9c232bb310636ceb376987bfe82add01070276b.tar.gz
stonesense-f9c232bb310636ceb376987bfe82add01070276b.tar.bz2
stonesense-f9c232bb310636ceb376987bfe82add01070276b.tar.xz
First pass at using Building Occupancies
Diffstat (limited to 'BlockCondition.cpp')
-rw-r--r--BlockCondition.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/BlockCondition.cpp b/BlockCondition.cpp
index 1985fc9..ce4bb67 100644
--- a/BlockCondition.cpp
+++ b/BlockCondition.cpp
@@ -59,6 +59,26 @@ bool BlockCondition::Matches(Block* b){
return false;
}
+
+ if(type == Cond_NeighbourIdentical){
+
+ int blocksBuildingIndex = b->building.index;
+ int blocksBuildingOcc = b->occ.bits.building;
+
+ bool n = hasBuildingIdentity( b->ownerSegment->getBlock( b->x, b->y - 1, b->z ), blocksBuildingIndex, blocksBuildingOcc );
+ bool s = hasBuildingIdentity( b->ownerSegment->getBlock( b->x, b->y + 1, b->z ), blocksBuildingIndex, blocksBuildingOcc );
+ bool w = hasBuildingIdentity( b->ownerSegment->getBlock( b->x - 1, b->y, b->z ), blocksBuildingIndex, blocksBuildingOcc );
+ bool e = hasBuildingIdentity( b->ownerSegment->getBlock( b->x + 1, b->y, b->z ), blocksBuildingIndex, blocksBuildingOcc );
+
+ if( value == eSimpleN && n) return true;
+ if( value == eSimpleS && s) return true;
+ if( value == eSimpleW && w) return true;
+ if( value == eSimpleE && e) return true;
+
+ if( value == eSimpleSingle && !n && !s && !w && !e) return true;
+
+ return false;
+ }
return false;
}