|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.freecol.server.generator.SimpleMapGenerator
public class SimpleMapGenerator
Creates random maps and sets the starting locations for the players.
| Nested Class Summary | |
|---|---|
private class |
SimpleMapGenerator.Territory
|
| Field Summary | |
|---|---|
private LandGenerator |
landGenerator
|
private static java.util.logging.Logger |
logger
|
private OptionGroup |
mapGeneratorOptions
|
private static float |
MIN_DISTANCE_FROM_POLE
|
private java.util.Random |
random
|
private TerrainGenerator |
terrainGenerator
|
| Constructor Summary | |
|---|---|
SimpleMapGenerator(java.util.Random random,
Specification specification)
Creates a MapGenerator |
|
| Method Summary | |
|---|---|
private void |
createDebugUnits(Map map,
Player player,
Tile startTile)
|
void |
createEmptyMap(Game game,
boolean[][] landMap)
Creates a Map for the given Game. |
private void |
createEuropeanUnits(Map map,
java.util.List<Player> players)
Create two ships, one with a colonist, for each player, and select suitable starting positions. |
private void |
createIndianSettlements(Map map,
java.util.List<Player> players)
Create the Indian settlements, at least a capital for every nation and random numbers of other settlements. |
private void |
createLostCityRumours(Map map,
Game importGame)
Creates lost city rumours on the given map. |
void |
createMap(Game game)
Creates a map given for a game. |
private Tile |
findFreeNeighbouringTile(IndianSettlement is,
java.util.List<Tile> tiles,
java.util.Random random)
|
private Tile |
findTileFor(Map map,
int row,
int start,
boolean startAtSea)
|
private UnitType |
generateSkillForLocation(Map map,
Tile tile,
NationType nationType)
Generates a skill that could be taught from a settlement on the given Tile. |
private java.util.List<Map.Position> |
generateStartingPositions(Map map,
java.util.List<Player> players)
|
private SimpleMapGenerator.Territory |
getClosestTerritory(Tile tile,
java.util.List<SimpleMapGenerator.Territory> territories)
|
private Tile |
getClosestTile(Map.Position center,
java.util.List<Tile> tiles)
|
private int |
getLand()
Returns the approximate number of land tiles. |
LandGenerator |
getLandGenerator()
|
OptionGroup |
getMapGeneratorOptions()
Gets the options used when generating the map. |
TerrainGenerator |
getTerrainGenerator()
|
private IndianSettlement |
placeIndianSettlement(Player player,
boolean capital,
Map.Position position,
Map map)
Builds a IndianSettlement at the given position. |
private boolean |
suitableForNativeSettlement(Tile tile)
Is a tile suitable for a native settlement? Require the tile be settleable, and at least half its neighbours also be settleable. |
| 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
private final java.util.Random random
private final OptionGroup mapGeneratorOptions
private final LandGenerator landGenerator
private final TerrainGenerator terrainGenerator
private static final float MIN_DISTANCE_FROM_POLE
| Constructor Detail |
|---|
public SimpleMapGenerator(java.util.Random random,
Specification specification)
MapGenerator
random - The Random number source to use.specification - a Specification valuecreateMap(net.sf.freecol.common.model.Game)| Method Detail |
|---|
private int getLand()
public void createMap(Game game)
throws FreeColException
createMap in interface MapGeneratorgame - The Game to use.
FreeColExceptionnet.sf.freecol.server.generator.IMapGenerator#createMap(net.sf.freecol.common.model.Game),
net.sf.freecol.server.generator.IMapGenerator#createMap(net.sf.freecol.common.model.Game)
public void createEmptyMap(Game game,
boolean[][] landMap)
Map for the given Game.
The Map is added to the Game after
it is created.
createEmptyMap in interface MapGeneratorgame - 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,
TerrainGenerator.createMap(net.sf.freecol.common.model.Game, boolean[][])public LandGenerator getLandGenerator()
public TerrainGenerator getTerrainGenerator()
public OptionGroup getMapGeneratorOptions()
MapGenerator
getMapGeneratorOptions in interface MapGeneratorMapGeneratorOptions.
private void createLostCityRumours(Map map,
Game importGame)
map - The map to use.importGame - The game to lost city rumours from.
private void createIndianSettlements(Map map,
java.util.List<Player> players)
map - The Map to place the indian settlements on.players - The players to create Settlements
and starting locations for. That is; both indian and
european players. If players does not contain any indian players,
no settlements are added.private boolean suitableForNativeSettlement(Tile tile)
tile - The Tile to examine.
private Tile findFreeNeighbouringTile(IndianSettlement is,
java.util.List<Tile> tiles,
java.util.Random random)
private Tile getClosestTile(Map.Position center,
java.util.List<Tile> tiles)
private SimpleMapGenerator.Territory getClosestTerritory(Tile tile,
java.util.List<SimpleMapGenerator.Territory> territories)
private IndianSettlement placeIndianSettlement(Player player,
boolean capital,
Map.Position position,
Map map)
IndianSettlement at the given position.
player - The player owning the new settlement.capital - true if the settlement should be a
capital.position - The position to place the settlement.map - The map that should get a new settlement.
IndianSettlement just being placed
on the map.
private UnitType generateSkillForLocation(Map map,
Tile tile,
NationType nationType)
map - The Map.tile - The tile where the settlement will be located.
private void createEuropeanUnits(Map map,
java.util.List<Player> players)
map - The Map to place the european units on.players - The players to create Settlements
and starting locations for. That is; both indian and
european players.
private void createDebugUnits(Map map,
Player player,
Tile startTile)
private java.util.List<Map.Position> generateStartingPositions(Map map,
java.util.List<Player> players)
private Tile findTileFor(Map map,
int row,
int start,
boolean startAtSea)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||