|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.freecol.server.generator.MapGenerator
public class MapGenerator
Creates random maps and sets the starting locations for the players.
| Nested Class Summary | |
|---|---|
private class |
MapGenerator.Territory
|
| Field Summary | |
|---|---|
private LandGenerator |
landGenerator
|
private static java.util.logging.Logger |
logger
|
private MapGeneratorOptions |
mapGeneratorOptions
|
private static float |
MIN_DISTANCE_FROM_POLE
|
private java.util.Random |
random
|
private TerrainGenerator |
terrainGenerator
|
| Constructor Summary | |
|---|---|
MapGenerator(java.util.Random random)
Creates a MapGenerator |
|
| Method Summary | |
|---|---|
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 the map with the current set options |
private UnitType |
generateSkillForLocation(Map map,
Tile tile,
NationType nationType)
Generates a skill that could be taught from a settlement on the given Tile. |
private MapGenerator.Territory |
getClosestTerritory(Map map,
Tile tile,
java.util.List<MapGenerator.Territory> territories)
|
private Tile |
getClosestTile(Map map,
Map.Position center,
java.util.List<Tile> tiles)
|
LandGenerator |
getLandGenerator()
|
MapGeneratorOptions |
getMapGeneratorOptions()
Gets the options used when generating the map. |
TerrainGenerator |
getTerrainGenerator()
|
private boolean |
isStartingPositionTooClose(Map map,
int proposedY,
int startingPositions,
java.util.List<java.lang.Integer> usedYPositions)
Determine whether a proposed ship starting Y position is "too close" to those already used. |
private Game |
loadSaveGame(java.io.File importFile)
Loads a Game from the given File. |
private IndianSettlement |
placeIndianSettlement(Player player,
boolean capital,
Map.Position position,
Map map)
Builds a IndianSettlement at the given position. |
| 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 MapGeneratorOptions mapGeneratorOptions
private final LandGenerator landGenerator
private final TerrainGenerator terrainGenerator
private static final float MIN_DISTANCE_FROM_POLE
| Constructor Detail |
|---|
public MapGenerator(java.util.Random random)
MapGenerator
createMap(net.sf.freecol.common.model.Game)| Method Detail |
|---|
public void createMap(Game game)
throws FreeColException
IMapGenerator
createMap in interface IMapGeneratorFreeColException
private Game loadSaveGame(java.io.File importFile)
throws FreeColException
Game from the given File.
importFile - The File to be loading the
Game from.
Game.
FreeColExceptionpublic LandGenerator getLandGenerator()
public TerrainGenerator getTerrainGenerator()
public MapGeneratorOptions getMapGeneratorOptions()
IMapGenerator
getMapGeneratorOptions in interface IMapGeneratorMapGeneratorOptions.
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 Tile getClosestTile(Map map,
Map.Position center,
java.util.List<Tile> tiles)
private MapGenerator.Territory getClosestTerritory(Map map,
Tile tile,
java.util.List<MapGenerator.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 boolean isStartingPositionTooClose(Map map,
int proposedY,
int startingPositions,
java.util.List<java.lang.Integer> usedYPositions)
map - a Map valueproposedY - Proposed ship starting Y positionstartingPositions - The number of starting positions
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||