|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ModelController
The ModelController
is used by the model to perform
tasks which cannot be done by the model.
The tasks might not be allowed to perform within the model (like generating
random numbers or creating new FreeColGameObjects
),
or the model might have insufficient data.
Any FreeColGameObject
may get access to the ModelController
by using getGame().getModelController()
.
Method Summary | |
---|---|
Building |
createBuilding(java.lang.String taskID,
Colony colony,
BuildingType type)
Creates a new building. |
Unit |
createUnit(java.lang.String taskID,
Location location,
Player owner,
UnitType type)
Creates a new unit. |
void |
exploreTiles(Player player,
java.util.ArrayList<Tile> tiles)
Explores the given tiles for the given player. |
TradeRoute |
getNewTradeRoute(Player player)
Get a new TradeRoute object. |
int |
getRandom(java.lang.String taskID,
int n)
Returns a pseudo-random int, uniformly distributed between 0 (inclusive) and the specified value (exclusive). |
void |
setStance(Player first,
Player second,
Player.Stance stance)
Updates stances. |
Location |
setToVacantEntryLocation(Unit unit)
Puts the specified Unit in America. |
void |
tileImprovementFinished(Unit unit,
TileImprovement improvement)
Tells the ModelController that a tile improvement was finished |
Method Detail |
---|
Unit createUnit(java.lang.String taskID, Location location, Player owner, UnitType type)
taskID
- The taskID
should be a unique identifier.
One method to make a unique taskID
:
location
- The Location
where the Unit
will be created.owner
- The Player
owning the Unit
.type
- The type of unit (Unit.FREE_COLONIST...).
Unit
.Building createBuilding(java.lang.String taskID, Colony colony, BuildingType type)
taskID
- The taskID
should be a unique identifier.
One method to make a unique taskID
:
colony
- The Colony
where the Building
will be created.type
- The type of building.
Building
.Location setToVacantEntryLocation(Unit unit)
Unit
in America.
unit
- The Unit
.
Location
where the Unit
appears.void exploreTiles(Player player, java.util.ArrayList<Tile> tiles)
player
- The Player
that should see more tiles.tiles
- The tiles to explore.void tileImprovementFinished(Unit unit, TileImprovement improvement)
ModelController
that a tile improvement was finished
unit
- an Unit
valueimprovement
- a TileImprovement
valuevoid setStance(Player first, Player second, Player.Stance stance)
first
- The first Player
.second
- The second Player
.stance
- The new stance.int getRandom(java.lang.String taskID, int n)
taskID
- The taskID
should be a unique identifier.
One method to make a unique taskID
:
n
- The specified value.
TradeRoute getNewTradeRoute(Player player)
TradeRoute
object.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |