diff options
| author | Jonas Ask | 2009-10-30 16:58:33 +0000 |
|---|---|---|
| committer | Jonas Ask | 2009-10-30 16:58:33 +0000 |
| commit | e26c9dddec01ccf7ac7b0467407afeaec8aeabe5 (patch) | |
| tree | f7a890a0e7ea0892a92ad9aff20eab9546c8f1cd /GameBuildings.cpp | |
| parent | a17037974d9053650558f86d527720c9e843d283 (diff) | |
| download | stonesense-e26c9dddec01ccf7ac7b0467407afeaec8aeabe5.tar.gz stonesense-e26c9dddec01ccf7ac7b0467407afeaec8aeabe5.tar.bz2 stonesense-e26c9dddec01ccf7ac7b0467407afeaec8aeabe5.tar.xz | |
Reinstated floating buildings. With some cost to rendering
Diffstat (limited to 'GameBuildings.cpp')
| -rw-r--r-- | GameBuildings.cpp | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/GameBuildings.cpp b/GameBuildings.cpp index b2eafca..46454ed 100644 --- a/GameBuildings.cpp +++ b/GameBuildings.cpp @@ -94,15 +94,29 @@ void MergeBuildingsToSegment(vector<t_building>* buildings, WorldSegment* segmen for(uint32_t yy = tempbuilding.y1; yy <= tempbuilding.y2; yy++)
for(uint32_t xx = tempbuilding.x1; xx <= tempbuilding.x2; xx++){
Block* b;
- //want hashtable :(
- if( b = segment->getBlock( xx, yy, tempbuilding.z) ){
- //handle special case where zones and stockpiles overlap buildings, and try to replace them
- if(b->building.info.type != BUILDINGTYPE_NA && tempbuilding.type == BUILDINGTYPE_ZONE )
- continue;
- if(b->building.info.type != BUILDINGTYPE_NA && tempbuilding.type == BUILDINGTYPE_STOCKPILE )
- continue;
-
- b->building.info = tempbuilding;
+ bool inside = segment->CoordinateInsideSegment(xx,yy, tempbuilding.z);
+ if(inside){
+ //want hashtable :(
+ b = segment->getBlock( xx, yy, tempbuilding.z);
+
+ if(!b){
+ //inside segment, but no block to represent it
+ b = new Block(segment);
+ b->x = xx;
+ b->y = yy;
+ b->z = tempbuilding.z;
+ segment->addBlock( b );
+ }
+
+ if( b ){
+ //handle special case where zones and stockpiles overlap buildings, and try to replace them
+ if(b->building.info.type != BUILDINGTYPE_NA && tempbuilding.type == BUILDINGTYPE_ZONE )
+ continue;
+ if(b->building.info.type != BUILDINGTYPE_NA && tempbuilding.type == BUILDINGTYPE_STOCKPILE )
+ continue;
+
+ b->building.info = tempbuilding;
+ }
}
}
index++;
|
