boolean didBunkerEntrance = false;
// where it all begins
int originX = platmap.originX;
int originZ = platmap.originZ;
HeightInfo heights;
// highest special place
int maxHeight = Integer.MIN_VALUE;
int maxHeightX = -1;
int maxHeightZ = -1;
HeightState maxState = HeightState.BUILDING;
// lowest special place
int minHeight = Integer.MAX_VALUE;
int minHeightX = -1;
int minHeightZ = -1;
HeightState minState = HeightState.BUILDING;
// is this natural or buildable?
for (int x = 0; x < PlatMap.Width; x++) {
for (int z = 0; z < PlatMap.Width; z++) {
PlatLot current = platmap.getLot(x, z);
if (current == null) {
// what is the world location of the lot?
int chunkX = originX + x;
int chunkZ = originZ + z;
int blockX = chunkX * SupportChunk.chunksBlockWidth;
int blockZ = chunkZ * SupportChunk.chunksBlockWidth;
// get the height info for this chunk
heights = HeightInfo.getHeightsFaster(generator, blockX, blockZ);
if (!heights.isBuildable()) {
// our inner chunks?
if (x > 0 && x < PlatMap.Width - 1 && z > 0 && z < PlatMap.Width - 1) {
// extreme changes?
if (heights.minHeight < minHeight) {
minHeight = heights.minHeight;
minHeightX = x;
minHeightZ = z;
minState = heights.state;
}
if (heights.maxHeight > maxHeight) {
maxHeight = heights.maxHeight;
maxHeightX = x;
maxHeightZ = z;
maxState = heights.state;
}
// innermost chunks?
boolean potentialRoads = (x == (RoadLot.PlatMapRoadInset - 1) || x == (PlatMap.Width - RoadLot.PlatMapRoadInset)) &&
(z == (RoadLot.PlatMapRoadInset - 1) || z == (PlatMap.Width - RoadLot.PlatMapRoadInset));
boolean doBunkerEntrance = doBunkers && !didBunkerEntrance && !potentialRoads;
// what type of height are we talking about?
switch (heights.state) {
case MIDLAND:
// // if not one of the innermost or the height isn't tall enough for bunkers
// if (!innermost || minHeight < BunkerLot.calcBunkerMinHeight(generator)) {
// if (heights.isSortaFlat() && generator.shapeProvider.isIsolatedConstructAt(originX + x, originZ + z, oddsOfIsolatedConstructs))
// current = createSurfaceBuildingLot(generator, platmap, originX + x, originZ + z, heights);
//
// else if (doBunkers && innermost) {
// current = createBuriedBuildingLot(generator, platmap, chunkX, chunkZ, !didBunkers);
// didBunkers = true;
// }
// }
if (doBunkers && minHeight > BunkerLot.calcBunkerMinHeight(generator)) {
current = createBuriedBuildingLot(generator, platmap, chunkX, chunkZ, doBunkerEntrance);
} else if (heights.isSortaFlat() && generator.shapeProvider.isIsolatedConstructAt(originX + x, originZ + z, oddsOfIsolatedConstructs)) {
current = createSurfaceBuildingLot(generator, platmap, originX + x, originZ + z, heights);
}
break;
case HIGHLAND: