MWClient execution logic

From MMNet Wiki
Revision as of 04:45, 7 May 2016 by Tubealloy (talk | contribs)
Jump to navigation Jump to search

Under construction 1) Main method sets up logs using static methods of CampaignData which points to MWLogger ( Should we switch to a logger like log4j? )

2) Stdout and StdErr are set to /logs/megameklog.txt since megamek uses stdout and stderr ( duplicated code in MWDedHost, again should we use log4j? )

3) Args are parsed, ded is set to true if -dedicated is set, enable or disable splash is read.

4) New CConfig is created by reading

 data/mwconfig.txt or data/mwconfig.txt.bak
 serverdata.dat if present
 images including camo if not a dedicated server

5 )Splash screen is enabled or disabled and data/mechfiles/units.cache is deleted if it exists

6) The created CConfig is passed as the argument for a new MWClient

7) The MWClient either calls the MekWarsDed.jar if it's a dedicated instance or sets the look and feel if not.

8) MWClient stores a reference to the java runtime bean at rt

9) MWClient creates a new CConnector, passing itself as the argument (since it implements IClient ) and sets the splash window.

10) If not a ded the client creates the gui etc. as follows -

 Create a new CCampaign which in turn holds CPlayer and a reference to MWClient
 Grab the player reference from the CCampaign
 Initialise and set the protocal commands (comm, ping, pong and acksignon )
 Initialise and set gui commands ( Ping and Mail )
 Set the "loading data" status on the splash screen
 Show sign on dialog if autoconnect is false or if serverip, name or password are empty
 Create a datafetcher on specified port 
 Check for data/servers/<serverip>.<serverport>/dataLastUpdated.dat. Set the cache to use this directory
 Load the ops list
 set up ops

If it is a ded then it does the following

 create protocol commands
 create datafetcher, grab the ops
 delete mmconf/gameoptions.xml if it exists