use of org.openbw.bwapi4j.TilePosition in project Ecgberht by Jabbo16.
the class AreaInitializer method computeBaseLocationScore.
private int computeBaseLocationScore(final TerrainData terrainData, final TilePosition location) {
final TilePosition dimCC = UnitType.Terran_Command_Center.tileSize();
int sumScore = 0;
for (int dy = 0; dy < dimCC.getY(); ++dy) {
for (int dx = 0; dx < dimCC.getX(); ++dx) {
final Tile tile = terrainData.getTile(location.add(new TilePosition(dx, dy)), CheckMode.NO_CHECK);
if (!tile.isBuildable()) {
return -1;
}
if (tile.getInternalData() == -1) {
// very reason of validateBaseLocation
return -1;
}
if (!tile.getAreaId().equals(getId())) {
return -1;
}
if (tile.getNeutral() instanceof StaticBuilding) {
return -1;
}
sumScore += tile.getInternalData();
}
}
return sumScore;
}
Aggregations