int numberOfShallowFields = 0;
for(int x = 0;x < mapdata.getArrayWidth();x++)
for(int y = 0;y < mapdata.getArrayHeight();y++)
if(mapdata.isArrayCoordOnMap(x,y))
{
Field field = mapdata.getField(x,y);
if(field.isSea())
{
double probability = 0;
int dst = field.getDistanceToCoast();
int index = dst - 1;
if(index > configuration.length - 1)
index = configuration.length - 1;
if(field.isNormalSea())
probability = configuration[index][0];
else
if(field.isDeepSea())
probability = configuration[index][1];
else
if(field.isSeaMountain())
probability = configuration[index][2];
else
if(field.isSeaVolcano())
probability = configuration[index][3];
if((probability >= 1)
|| ((probability > 0) && (randomgen.nextDouble() < probability)))
{
field.setHeightLevel(Field.Height.SHALLOW_SEA);
numberOfShallowFields++;
}
}
}
return numberOfShallowFields;