|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.freecol.server.generator.TerrainGenerator
public class TerrainGenerator
Class for making a Map based upon a land map.
| Field Summary | |
|---|---|
private TileImprovementType |
fishBonusLandType
|
private TileImprovementType |
fishBonusRiverType
|
private TileType |
lake
|
static int |
LAND_REGION_MAX_SIZE
|
static int |
LAND_REGION_MIN_SCORE
|
static int |
LAND_REGIONS_SCORE_VALUE
|
private static java.util.logging.Logger |
logger
|
private MapGeneratorOptions |
mapGeneratorOptions
|
private TileType |
ocean
|
static int |
PACIFIC_SCORE_VALUE
|
private java.util.Random |
random
|
private TileImprovementType |
riverType
|
private java.util.ArrayList<TileType> |
terrainTileTypes
|
| Constructor Summary | |
|---|---|
TerrainGenerator(MapGeneratorOptions mapGeneratorOptions,
java.util.Random random)
Creates a new TerrainGenerator. |
|
| Method Summary | |
|---|---|
private void |
createHighSeas(Map map)
Places "high seas"-tiles on the border of the given map. |
private static void |
createHighSeas(Map map,
int distToLandFromHighSeas,
int maxDistanceToEdge)
Places "high seas"-tiles on the border of the given map. |
(package private) void |
createLandRegions(Map map)
Creates land map regions in the given Map. |
void |
createMap(Game game,
boolean[][] landMap)
Creates a Map for the given Game. |
void |
createMap(Game game,
Game importGame,
boolean[][] landMap)
Creates a Map for the given Game. |
private void |
createMountains(Map map)
Creates mountain ranges on the given map. |
(package private) void |
createOceanRegions(Map map)
Creates ocean map regions in the given Map. |
private void |
createRivers(Map map)
Creates rivers on the given map. |
private Tile |
createTile(Game game,
int x,
int y,
boolean[][] landMap,
int latitude)
|
static void |
determineHighSeas(Map map,
int distToLandFromHighSeas,
int maxDistanceToEdge)
Places "high seas"-tiles on the border of the given map. |
static void |
encodeStyle(Tile tile)
|
private void |
fillOcean(Map map,
Map.Position p,
Region region,
java.awt.Rectangle bounds)
Flood fill ocean regions. |
private void |
findLakes(Map map)
|
private boolean[][] |
floodFill(boolean[][] boolmap,
Map.Position p)
|
private boolean[][] |
floodFill(boolean[][] boolmap,
Map.Position p,
int limit)
Floodfills from a given Position p, based on connectivity
information encoded in boolmap |
private MapGeneratorOptions |
getMapGeneratorOptions()
Gets the MapGeneratorOptions. |
private TileType |
getRandomLandTileType(int latitudePercent)
Gets a random land tile type based on the given percentage. |
private void |
perhapsAddBonus(Game game,
Tile t,
boolean generateBonus)
Adds a terrain bonus with a probability determined by the MapGeneratorOptions. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final java.util.logging.Logger logger
public static final int LAND_REGIONS_SCORE_VALUE
public static final int LAND_REGION_MIN_SCORE
public static final int PACIFIC_SCORE_VALUE
public static final int LAND_REGION_MAX_SIZE
private final MapGeneratorOptions mapGeneratorOptions
private java.util.Random random
private TileType ocean
private TileType lake
private TileImprovementType riverType
private TileImprovementType fishBonusLandType
private TileImprovementType fishBonusRiverType
private java.util.ArrayList<TileType> terrainTileTypes
| Constructor Detail |
|---|
public TerrainGenerator(MapGeneratorOptions mapGeneratorOptions,
java.util.Random random)
TerrainGenerator.
createMap(net.sf.freecol.common.model.Game, boolean[][])| Method Detail |
|---|
public void createMap(Game game,
boolean[][] landMap)
Map for the given Game.
The Map is added to the Game after it is
created.
game - The game.landMap - Determines whether there should be land or ocean on a
given tile. This array also specifies the size of the map that
is going to be created.Map
public void createMap(Game game,
Game importGame,
boolean[][] landMap)
Map for the given Game.
The Map is added to the Game after it is
created.
game - The game.importGame - The game to import information form.landMap - Determines whether there should be land or ocean on a
given tile. This array also specifies the size of the map that
is going to be created.Mappublic static void encodeStyle(Tile tile)
private Tile createTile(Game game,
int x,
int y,
boolean[][] landMap,
int latitude)
private void perhapsAddBonus(Game game,
Tile t,
boolean generateBonus)
MapGeneratorOptions.
game - a Game valuet - a Tile valuegenerateBonus - a boolean valueprivate MapGeneratorOptions getMapGeneratorOptions()
MapGeneratorOptions.
MapGeneratorOptions being used when creating
terrain.private TileType getRandomLandTileType(int latitudePercent)
latitudePercent - The location of the tile relative to the
north/south poles and equator, 100% is the mid-section of the
map (equator) 0% is on the top/bottom of the map (poles).void createOceanRegions(Map map)
map - a Map value
private void fillOcean(Map map,
Map.Position p,
Region region,
java.awt.Rectangle bounds)
map - The Map to fill in.p - A valid starting Position.region - A Region to fill with.bounds - A Rectangle that bounds the filling.void createLandRegions(Map map)
LandGenerator.POLAR_HEIGHT
For the remaining land tiles, one region per contiguous landmass is
created.
map - a Map valueprivate void createHighSeas(Map map)
map - The Map to create high seas on.
public static void determineHighSeas(Map map,
int distToLandFromHighSeas,
int maxDistanceToEdge)
map - The Map to create high seas on.distToLandFromHighSeas - The distance between the land and the high
seas (given in tiles).maxDistanceToEdge - The maximum distance a high sea tile can have
from the edge of the map.
private static void createHighSeas(Map map,
int distToLandFromHighSeas,
int maxDistanceToEdge)
map - The Map to create high seas on.distToLandFromHighSeas - The distance between the land and the high
seas (given in tiles).maxDistanceToEdge - The maximum distance a high sea tile can have
from the edge of the map.private void createMountains(Map map)
map - The map to use.private void createRivers(Map map)
map - The map to create rivers on.private void findLakes(Map map)
private boolean[][] floodFill(boolean[][] boolmap,
Map.Position p,
int limit)
Position p, based on connectivity
information encoded in boolmap
boolmap - The connectivity information for this floodfillp - The starting positionlimit - Limit to stop floodfill at
private boolean[][] floodFill(boolean[][] boolmap,
Map.Position p)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||