|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.freecol.client.control.InGameController
public final class InGameController
The controller that will be used while the game is played.
Field Summary |
---|
Fields inherited from interface net.sf.freecol.common.networking.NetworkConstants |
---|
NO_NEED_FOR_THE_GOODS, NO_TRADE |
Constructor Summary | |
---|---|
InGameController(FreeColClient freeColClient)
The constructor to use. |
Method Summary | |
---|---|
void |
abandonColony(Colony colony)
Abandon a colony with no units |
void |
assignTeacher(Unit student,
Unit teacher)
Assigns a unit to a teacher Unit . |
void |
assignTradeRoute(Unit unit)
Assigns a trade route to a unit. |
void |
assignTradeRoute(Unit unit,
TradeRoute tradeRoute)
|
void |
autosaveGame()
|
boolean |
boardShip(Unit unit,
Unit carrier)
Boards a specified unit onto a carrier. |
void |
buildColony()
Uses the active unit to build a colony. |
void |
buyGoods(GoodsType type,
int amount,
Unit carrier)
Buys goods in Europe. |
void |
centerActiveUnit()
Centers the map on the selected tile. |
void |
centerOnUnit(Unit unit)
Centers the map on the given unit location. |
void |
changeState(Unit unit,
Unit.UnitState state)
Changes the state of this Unit . |
void |
changeWorkImprovementType(Unit unit,
TileImprovementType improvementType)
Changes the work type of this Unit . |
void |
changeWorkType(Unit unit,
GoodsType workType)
Changes the work type of this Unit . |
boolean |
checkCashInTreasureTrain(Unit unit)
Check if a unit is a treasure train, and if it should be cashed in. |
boolean |
claimLand(Tile tile,
Colony colony,
int offer)
Claim a piece of land. |
void |
clearGotoOrders(Unit unit)
Clears the orders of the given Unit . |
void |
clearOrders(Unit unit)
Clears the orders of the given Unit The orders are cleared
by making the unit Unit.UnitState.ACTIVE and setting a null
destination |
void |
clearSpeciality(Unit unit)
Clear the speciality of a Unit . |
void |
debugForeignColony(Tile tile)
|
void |
declareIndependence()
Declares independence for the home country. |
void |
disbandActiveUnit()
Disbands the active unit. |
void |
displayModelMessages(boolean allMessages)
|
void |
endTurn()
End the turn. |
void |
equipUnit(Unit unit,
EquipmentType type,
int amount)
Equips or unequips a Unit with a certain type of
Goods . |
void |
executeGotoOrders()
Executes the units' goto orders. |
org.w3c.dom.Element |
getForeignAffairsReport()
Gathers information about opponents. |
org.w3c.dom.Element |
getHighScores()
Retrieves high scores from server. |
java.util.List<AbstractUnit> |
getREFUnits()
Gathers information about the REF. |
StatisticsMessage |
getServerStatistics()
Retrieves server statistics |
void |
ignoreMessage(ModelMessage message,
boolean flag)
Ignore this ModelMessage from now on until it is not generated in a turn. |
void |
leaveShip(Unit unit)
Leave a ship. |
void |
loadCargo(Goods goods,
Unit carrier)
Loads a cargo onto a carrier. |
void |
loadGame()
Opens a dialog where the user should specify the filename and loads the game. |
void |
move(Unit unit,
Map.Direction direction)
Moves the specified unit in a specified direction. |
void |
moveActiveUnit(Map.Direction direction)
Moves the active unit in a specified direction. |
void |
moveToAmerica(Unit unit)
Moves the specified unit to America. |
void |
moveToDestination(Unit unit)
Moves the given unit towards the destination given by Unit.getDestination() . |
void |
moveToEurope(Unit unit)
Moves the specified unit to Europe. |
void |
nextActiveUnit()
Makes a new unit active. |
void |
nextActiveUnit(Tile tile)
Makes a new unit active. |
void |
nextModelMessage()
Displays the next ModelMessage . |
void |
payArrears(Goods goods)
Pays the tax arrears on this type of goods. |
void |
payArrears(GoodsType type)
Pays the tax arrears on this type of goods. |
void |
payForBuilding(Colony colony)
Buys the remaining hammers and tools for the Building currently
being built in the given Colony . |
void |
purchaseUnitFromEurope(UnitType unitType)
Purchases a unit of a specified type in Europe. |
boolean |
putOutsideColony(Unit unit)
Puts the specified unit outside the colony. |
void |
recruitUnitInEurope(int slot)
Recruit a unit from a specified "slot" in Europe. |
void |
rename(Nameable object)
Renames a Nameable . |
void |
saveGame()
Opens a dialog where the user should specify the filename and saves the game. |
void |
saveGame(java.io.File file)
Saves the game to the given file. |
void |
selectDestination(Unit unit)
Selects a destination for this unit. |
void |
sellGoods(Goods goods)
Sells goods in Europe. |
void |
sendChat(java.lang.String message)
Sends a public chat message. |
void |
setBuildQueue(Colony colony,
java.util.List<BuildableType> buildQueue)
Changes the current construction project of a Colony . |
void |
setCurrentPlayer(Player currentPlayer)
Sets player as the new currentPlayer of the
game. |
void |
setDestination(Unit unit,
Location destination)
Sets the destination of the given unit and send the server a message for this action. |
void |
setGoodsLevels(Colony colony,
GoodsType goodsType)
Sets the export settings of the custom house. |
void |
setInDebugMode(boolean debug)
Sets the "debug mode" to be active or not. |
void |
setTradeRoutes(java.util.List<TradeRoute> routes)
Sets the trade routes for this player |
void |
trainUnitInEurope(UnitType unitType)
Trains a unit of a specified type in Europe. |
void |
unloadCargo(Goods goods)
Unload cargo. |
void |
unloadCargo(Goods goods,
boolean dump)
Unload cargo. |
void |
updateTradeRoute(TradeRoute route)
Updates a trade route. |
void |
work(Unit unit,
WorkLocation workLocation)
Moves a Unit to a WorkLocation . |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public InGameController(FreeColClient freeColClient)
freeColClient
- The main controller.Method Detail |
---|
public void saveGame()
public void saveGame(java.io.File file)
file
- The File
.public void loadGame()
public void setInDebugMode(boolean debug)
FreeCol.setInDebugMode(boolean)
and reinitialize the
FreeColMenuBar
.
debug
- Should be set to true
in order to enable
debug mode.public void declareIndependence()
public void sendChat(java.lang.String message)
message
- The text of the message.public void setCurrentPlayer(Player currentPlayer)
player
as the new currentPlayer
of the
game.
currentPlayer
- The player.public void autosaveGame()
public void rename(Nameable object)
Nameable
.
object
- The object to rename.public void buildColony()
public void moveActiveUnit(Map.Direction direction)
direction
- The direction in which to move the active unit.public void selectDestination(Unit unit)
unit
- The unit for which to select a destination.public void setDestination(Unit unit, Location destination)
unit
- The Unit
to direct.destination
- The destination Location
.Unit.setDestination(Location)
public void moveToDestination(Unit unit)
Unit.getDestination()
.
unit
- The Unit
to move.public void move(Unit unit, Map.Direction direction)
unit
- The unit to be moved.direction
- The direction in which to move the Unit.public void debugForeignColony(Tile tile)
public boolean claimLand(Tile tile, Colony colony, int offer)
tile
- The land to claim.colony
- An optional Colony
to own the land.offer
- An offer to pay.
public boolean checkCashInTreasureTrain(Unit unit)
owner
.
unit
- The Unit
to be checked.
public boolean boardShip(Unit unit, Unit carrier)
unit
- The unit who is going to board the carrier.carrier
- The carrier.
unit
actually gets on the
carrier
.public void clearSpeciality(Unit unit)
Unit
. That is, makes it a
Unit.FREE_COLONIST
.
unit
- The Unit
to clear the speciality of.public void leaveShip(Unit unit)
unit
- The unit who is going to leave the ship where it is located.public void loadCargo(Goods goods, Unit carrier)
goods
- The goods which are going aboard the carrier.carrier
- The carrier.public void unloadCargo(Goods goods)
goods
- The goods which are going to leave the ship where it is
located.public void unloadCargo(Goods goods, boolean dump)
goods
- The goods which are going to leave the ship where it is
located.dump
- a boolean
valuepublic void buyGoods(GoodsType type, int amount, Unit carrier)
carrier
.
type
- The type of goods to buy.amount
- The amount of goods to buy.carrier
- The carrier.public void sellGoods(Goods goods)
goods
- The goods to be sold.public void setGoodsLevels(Colony colony, GoodsType goodsType)
colony
- The colony with the custom house.goodsType
- The goods for which to set the settings.public void equipUnit(Unit unit, EquipmentType type, int amount)
Unit
with a certain type of
Goods
.
unit
- The Unit
.type
- an EquipmentType
valueamount
- How many of these goods the unit should have.public void work(Unit unit, WorkLocation workLocation)
Unit
to a WorkLocation
.
unit
- The Unit
.workLocation
- The WorkLocation
.public boolean putOutsideColony(Unit unit)
unit
- The Unit
public void changeWorkType(Unit unit, GoodsType workType)
Unit
.
unit
- The Unit
workType
- The new GoodsType
to produce.public void changeWorkImprovementType(Unit unit, TileImprovementType improvementType)
Unit
.
unit
- The Unit
improvementType
- a TileImprovementType
valuepublic void assignTeacher(Unit student, Unit teacher)
Unit
.
student
- an Unit
valueteacher
- an Unit
valuepublic void setBuildQueue(Colony colony, java.util.List<BuildableType> buildQueue)
Colony
.
colony
- The Colony
public void changeState(Unit unit, Unit.UnitState state)
Unit
.
unit
- The Unit
state
- The state of the unit.public void clearOrders(Unit unit)
Unit
The orders are cleared
by making the unit Unit.UnitState.ACTIVE
and setting a null
destination
unit
- The Unit
.public void clearGotoOrders(Unit unit)
Unit
. The orders are
cleared by making the unit Unit.UnitState.ACTIVE
.
unit
- The Unit
.public void moveToEurope(Unit unit)
unit
- The unit to be moved to Europe.public void moveToAmerica(Unit unit)
unit
- The unit to be moved to America.public void trainUnitInEurope(UnitType unitType)
unitType
- The type of unit to be trained.public void payForBuilding(Colony colony)
Building
currently
being built in the given Colony
.
colony
- The Colony
where the building should be bought.public void recruitUnitInEurope(int slot)
slot
- The slot to recruit the unit from. Either 1, 2 or 3.public void updateTradeRoute(TradeRoute route)
route
- The trade route to update.public void setTradeRoutes(java.util.List<TradeRoute> routes)
routes
- The trade routes to set.public void assignTradeRoute(Unit unit)
unit
- The unit to assign a trade route to.public void assignTradeRoute(Unit unit, TradeRoute tradeRoute)
public void payArrears(Goods goods)
goods
- The goods for which to pay arrears.public void payArrears(GoodsType type)
type
- The type of goods for which to pay arrears.public void purchaseUnitFromEurope(UnitType unitType)
unitType
- The type of unit to be purchased.public org.w3c.dom.Element getForeignAffairsReport()
public org.w3c.dom.Element getHighScores()
public java.util.List<AbstractUnit> getREFUnits()
List
valuepublic void disbandActiveUnit()
public void centerActiveUnit()
public void centerOnUnit(Unit unit)
public void executeGotoOrders()
public void nextActiveUnit()
public void nextActiveUnit(Tile tile)
ModelMessage
s
(uses nextModelMessage()
).
tile
- The tile to select if no new unit can be made active.public void ignoreMessage(ModelMessage message, boolean flag)
message
- a ModelMessage
valueflag
- whether to ignore the ModelMessage or notpublic void nextModelMessage()
ModelMessage
.
ModelMessage
public void displayModelMessages(boolean allMessages)
public void endTurn()
public void abandonColony(Colony colony)
colony
- The colony to be abandonedpublic StatisticsMessage getServerStatistics()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |