net.sf.freecol.server.control
Class PreGameController

java.lang.Object
  extended by net.sf.freecol.server.control.FreeColServerHolder
      extended by net.sf.freecol.server.control.Controller
          extended by net.sf.freecol.server.control.PreGameController

public final class PreGameController
extends Controller

The control object that is responsible for setting parameters and starting a new game. PreGameInputHandler is used to receive and handle network messages from the clients.

The game enters the state FreeColServer.GameState.IN_GAME, when the startGame() has successfully been invoked.

See Also:
InGameInputHandler

Constructor Summary
PreGameController(FreeColServer freeColServer)
          The constructor to use.
 
Method Summary
 void sendUpdatedGame()
          Sets the map and sends an updated Game-object (that includes the map) to the clients.
 void startGame()
          Updates and starts the game.
 
Methods inherited from class net.sf.freecol.server.control.Controller
shutdown
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PreGameController

public PreGameController(FreeColServer freeColServer)
The constructor to use.

Parameters:
freeColServer - The main server object.
Method Detail

startGame

public void startGame()
               throws FreeColException
Updates and starts the game.

This method performs these tasks in the given order:
  1. Generates the map.
  2. Sends updated game information to the clients.
  3. Changes the game state to FreeColServer.GameState.IN_GAME.
  4. Sends the "startGame"-message to the clients.

Throws:
FreeColException

sendUpdatedGame

public void sendUpdatedGame()
Sets the map and sends an updated Game-object (that includes the map) to the clients.