diff options
| author | Jonas Ask | 2009-10-26 17:21:26 +0000 |
|---|---|---|
| committer | Jonas Ask | 2009-10-26 17:21:26 +0000 |
| commit | 6dec738a8917ab1cc824b1b28059ed79c4090f13 (patch) | |
| tree | 40ca5460032d8b0d30a669fcf99fba2adc369f5d /BlockCondition.cpp | |
| parent | 5db20febfa15e1465c11bc0c4c785c7667d728b4 (diff) | |
| download | stonesense-6dec738a8917ab1cc824b1b28059ed79c4090f13.tar.gz stonesense-6dec738a8917ab1cc824b1b28059ed79c4090f13.tar.bz2 stonesense-6dec738a8917ab1cc824b1b28059ed79c4090f13.tar.xz | |
Reworked how buildings are assigned sprites. Much more dynamic now.
Added more configurable options for buildings.
Diffstat (limited to 'BlockCondition.cpp')
| -rw-r--r-- | BlockCondition.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/BlockCondition.cpp b/BlockCondition.cpp index efae593..1985fc9 100644 --- a/BlockCondition.cpp +++ b/BlockCondition.cpp @@ -25,7 +25,7 @@ bool BlockCondition::Matches(Block* b){ }
if(type == Cond_NeighbourWall){
- dirTypes closebyWalls = findWallCloseTo(b->ownerSegment,b);
+ //dirTypes closebyWalls = findWallCloseTo(b->ownerSegment,b);
bool n = hasWall( b->ownerSegment->getBlock( b->x, b->y - 1, b->z ) );
bool s = hasWall( b->ownerSegment->getBlock( b->x, b->y + 1, b->z ) );
@@ -42,5 +42,23 @@ bool BlockCondition::Matches(Block* b){ return false;
}
+ if(type == Cond_NeighbourSameBuilding){
+ int blocksBuildingID = b->building.info.type;
+
+ bool n = hasBuildingOfID( b->ownerSegment->getBlock( b->x, b->y - 1, b->z ), blocksBuildingID );
+ bool s = hasBuildingOfID( b->ownerSegment->getBlock( b->x, b->y + 1, b->z ), blocksBuildingID );
+ bool w = hasBuildingOfID( b->ownerSegment->getBlock( b->x - 1, b->y, b->z ), blocksBuildingID);
+ bool e = hasBuildingOfID( b->ownerSegment->getBlock( b->x + 1, b->y, b->z ), blocksBuildingID );
+
+ 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;
}
|
