Class Start

java.lang.Object
net.sf.colossus.appmain.Start

public final class Start extends Object
Class Start contains code to start the different types of games.
Author:
David Ripton, Clemens Katzer (rewritten big parts of the main() method)
  • Field Details

    • LOGGER

      private static final Logger LOGGER
    • cmdLine

      private CmdLine cmdLine
    • whatNextManager

      private final WhatNextManager whatNextManager
    • startOptions

      private final Options startOptions
  • Constructor Details

    • Start

      public Start(String[] args)
      To create the one "Start" object which handles initiates the "whatToDoNext" action according to what the user wants. Brings up one of the dialogs, or starts a Game, a Network client or a Web Client.
  • Method Details

    • getStartOptions

      public Options getStartOptions()
    • getWhatNextManager

      public WhatNextManager getWhatNextManager()
    • getWhatToDoNext

      public WhatNextManager.WhatToDoNext getWhatToDoNext()
    • usage

      private static void usage(Opts opts)
      Print a usage string to stdout. (*Not* to the logfile, where casual users will miss it.)
    • commandLineProcessing

      private void commandLineProcessing(String[] args)
      Prepare the "Opts" object to parse all options from command line. As result, creates/sets the instance variable CmdLine object "cmdLine" from which one can then query which options were set, and their value if they require one.
      Parameters:
      args - The String-Array given to main()
    • setInitialAction

      public void setInitialAction(Options serverOptions, Options netclientOptions)
      Based on command line options -c, -w, possibly -g, set startObject to the right "whatToDoNext" action and set in startOptions the related values. Expects that server (cf) options are already loaded.
    • runGetPlayersDialogAndWait

      private void runGetPlayersDialogAndWait(Options options)
      Bring up the GetPlayers dialog, and then wait until is has set startObject to the next action to do and notified us to continue.
      Parameters:
      options - The "server side" main options Object which holds the information what kind of game to play next (variant, which players) and the "Game options" for the to-be-started game, like unlimitedMulligans, viewmode, balancedTowers, ...)
    • setupOptionsFromCommandLine

      private boolean setupOptionsFromCommandLine(CmdLine cl, Options startOptions, Options options)
    • setupAndLoop

      private void setupAndLoop()
      Do the setup of the various Options objects (server, netclient), some more preparations, and then it stays in the loop which - waits for user input what to do next - initiates that action and waits until it completes (or if canceled, like closing the network client dialog, bring up back the main (=GetPlayers) dialog, or if user requests Quit, exit the loop; and when it exited the loop control will return back to main() and the JVM should terminate sooner or later ;-)
    • runNetClientDialogAndWait

      private void runNetClientDialogAndWait()
    • startNetClient

      private boolean startNetClient(Options startOptions)
    • main

      public static void main(String[] args)