|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.freecol.server.generator.LandGenerator
public class LandGenerator
Class for creating a land map.
A land map is a two-dimensional array with the boolean
values:
true: landfalse: ocean
| Field Summary | |
|---|---|
private int |
genType
|
private int |
height
|
private int |
landMass
|
private boolean[][] |
map
|
private OptionGroup |
mapGeneratorOptions
|
private int |
minimumNumberOfTiles
|
private int |
numberOfLandTiles
|
private int |
preferredDistanceToEdge
|
private java.util.Random |
random
|
private int |
width
|
| Constructor Summary | |
|---|---|
LandGenerator(OptionGroup mapGeneratorOptions,
java.util.Random random)
Creates a new LandGenerator. |
|
| Method Summary | |
|---|---|
private void |
addLandmass(int minsize,
int maxsize)
|
private void |
addLandmass(int minsize,
int maxsize,
int x,
int y)
Tries to create a new land mass (unconnected to existing land masses) of size=maxsize, and adds it to the current map if it is at least size=minsize. |
private void |
addPolarRegions()
Adds land to the first two and last two rows. |
private void |
cleanMap()
Removes any 1x1 islands on the map. |
private void |
createClassicLandMap()
|
boolean[][] |
createLandMap()
Creates a new land map. |
private void |
growLand(int i,
int j)
Determines, based on position, number of adjacent land tiles and some random factor, whether a given map position should be set to land. |
static boolean[][] |
importLandMap(Game game)
Imports the land map from the given Game. |
private boolean |
isSingleTile(int x,
int y)
Returns true if there are no adjacent land to the given coordinates. |
private void |
setLand(int x,
int y)
Sets a given map position to land. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private final OptionGroup mapGeneratorOptions
private final java.util.Random random
private boolean[][] map
private int width
private int height
private int landMass
private int preferredDistanceToEdge
private int numberOfLandTiles
private int minimumNumberOfTiles
private int genType
| Constructor Detail |
|---|
public LandGenerator(OptionGroup mapGeneratorOptions,
java.util.Random random)
LandGenerator.
mapGeneratorOptions - The options to be
used when creating a land map.random - The Random number source to use.createLandMap()| Method Detail |
|---|
public static boolean[][] importLandMap(Game game)
Game.
game - The Game to get the land map from.
public boolean[][] createLandMap()
private void createClassicLandMap()
private void addLandmass(int minsize,
int maxsize,
int x,
int y)
private void addLandmass(int minsize,
int maxsize)
private void addPolarRegions()
private void cleanMap()
private boolean isSingleTile(int x,
int y)
private void setLand(int x,
int y)
private void growLand(int i,
int j)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||