diff options
| author | Kris Parker | 2009-11-01 03:53:37 +0000 |
|---|---|---|
| committer | Kris Parker | 2009-11-01 03:53:37 +0000 |
| commit | 27545f7259e05faf2a39f34e4a60f4f6d226f6e1 (patch) | |
| tree | 9f4d9fa55c49198f872aa667af611212bef3f153 /BlockCondition.cpp | |
| parent | f9c232bb310636ceb376987bfe82add01070276b (diff) | |
| download | stonesense-27545f7259e05faf2a39f34e4a60f4f6d226f6e1.tar.gz stonesense-27545f7259e05faf2a39f34e4a60f4f6d226f6e1.tar.bz2 stonesense-27545f7259e05faf2a39f34e4a60f4f6d226f6e1.tar.xz | |
More building checks in conditions
Diffstat (limited to 'BlockCondition.cpp')
| -rw-r--r-- | BlockCondition.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/BlockCondition.cpp b/BlockCondition.cpp index ce4bb67..ebc4f55 100644 --- a/BlockCondition.cpp +++ b/BlockCondition.cpp @@ -80,5 +80,28 @@ bool BlockCondition::Matches(Block* b){ return false;
}
+ if(type == Cond_NeighbourSameIndex){
+
+ int blocksBuildingIndex = b->building.index;
+
+ bool n = hasBuildingOfIndex( b->ownerSegment->getBlock( b->x, b->y - 1, b->z ), blocksBuildingIndex );
+ bool s = hasBuildingOfIndex( b->ownerSegment->getBlock( b->x, b->y + 1, b->z ), blocksBuildingIndex );
+ bool w = hasBuildingOfIndex( b->ownerSegment->getBlock( b->x - 1, b->y, b->z ), blocksBuildingIndex );
+ bool e = hasBuildingOfIndex( b->ownerSegment->getBlock( b->x + 1, b->y, b->z ), blocksBuildingIndex );
+
+ 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;
+ }
+
+ if(type == Cond_BuildingOcc){
+ return b->occ.bits.building == this->value;
+ }
+
return false;
}
|
