for (int n = 0; n < 100; n++) {
x = random.nextInt(mapData.getArrayWidth());
y = random.nextInt(mapData.getArrayHeight());
if (mapData.isArrayCoordOnMap(x, y)
&& civquest.map.Field.isLand(fieldReader.getHeightLevel(new Coordinate(x, y)))
&& cityReader.getCityID(new Coordinate(x, y)) == null) {
break;
}
}
if (!mapData.isArrayCoordOnMap(x, y)) {
Messages messages = Messages.getMessages();
messages.info("CivQuest", "GUITestData",
"addACity: No suitable place for a city found!");
return;
}
ConstructCity constructCity = new ConstructCity(new Coordinate(x, y),
nation);
constructCity.execute();
SetPopulation setPopulation
= new SetPopulation(new Coordinate(x, y), 1000);
setPopulation.execute();
SetFieldRuledByCity change
= new SetFieldRuledByCity(new Coordinate(x, y),
constructCity.getCity(), false);
change.execute();
}