GameClientRunner Class Reference

Creates command line that launches the client executable of the game and connects it to a server. More...

#include <gameclientrunner.h>

+ Inheritance diagram for GameClientRunner:

Public Member Functions

 GameClientRunner (ServerPtr server)
 
JoinError createJoinCommandLine (CommandLineInfo &cli, const ServerConnectParams &params)
 Fills out CommandLineInfo object that allows client executables to be launched. More...
 
JoinError joinError () const
 JoinError set by last call to createJoinCommandLine(). More...
 

Protected Member Functions

void addConnectCommand ()
 [Virtual] Adds connection arguments to the list. More...
 
void addConnectCommand_default ()
 
void addCustomParameters ()
 Adds custom parameters defined by user in configuration box to the args list. More...
 
void addDemoRecordCommand ()
 Adds command for demo recording. More...
 
void addExtra ()
 [Virtual] Plugins can easily add plugin-specific arguments here. More...
 
void addExtra_default ()
 
void addGamePaths ()
 Sets working directory and path to executable in out put CommandLineInfo. More...
 
void addInGamePassword ()
 [Virtual] Adds in-game password to the args list. More...
 
void addInGamePassword_default ()
 
void addIwad ()
 [Virtual] Plugins can replace IWAD discovery mechanism and generation of relevant executable parameters here. More...
 
void addIwad_default ()
 
void addPassword ()
 [Virtual] Adds connect password to the args list. More...
 
void addPassword_default ()
 
void addPwads ()
 Finds and adds each PWAD to the args list, marks missing WADs. More...
 
void addWads ()
 Calls addIwad() then addPwads(), sets JoinError::MissingWads in case of failure. More...
 
const QString & argForBexLoading () const
 
const QString & argForConnect () const
 Command line parameter that specifies the target server's IP and port. More...
 
const QString & argForConnectPassword () const
 Command line parameter that is used to specify connection password. More...
 
const QString & argForDehLoading () const
 Command line parameter that is used to load a DEHACKED file. More...
 
const QString & argForDemoRecord () const
 Command line parameter for recording a demo. More...
 
const QString & argForInGamePassword () const
 Command line parameter that is used to specify in-game ("join") password. More...
 
const QString & argForIwadLoading () const
 Command line parameter that is used to set IWAD. More...
 
const QString & argForOptionalWadLoading () const
 Command line parameter that is used to load optional WADs. More...
 
const QString & argForPort () const
 Command line parameter that is used to set internet port for the game. More...
 
const QString & argForPwadLoading () const
 Command line parameter that is used to load a PWAD. More...
 
QStringList & args ()
 Output command line arguments. More...
 
const QString & connectPassword () const
 Password for server connection. More...
 
void createCommandLineArguments ()
 [Virtual] Spawns entire command line for client executable launch. More...
 
void createCommandLineArguments_default ()
 
const QString & demoName () const
 Name of the demo if demo should be recorded, otherwise empty. More...
 
QString findWad (const QString &wad) const
 Finds WAD in a way that supports user configured aliases. More...
 
const QString & inGamePassword () const
 "Join" password required in game. More...
 
bool isIwadFound () const
 
const QString & iwadPath () const
 
void markPwadAsMissing (const PWad &pwadName)
 Stores PWAD in an internal list of missing WADs. More...
 
PathFinderpathFinder ()
 Reference to a PathFinder belonging to this GameClientRunner. More...
 
QString pathToOfflineExe (Message &msg)
 Retrieves path to offline exe from plugin's ExeFile. More...
 
 POLYMORPHIC_SETTER_DECLARE (void, GameClientRunner, addConnectCommand,())
 
 POLYMORPHIC_SETTER_DECLARE (void, GameClientRunner, addExtra,())
 
 POLYMORPHIC_SETTER_DECLARE (void, GameClientRunner, addInGamePassword,())
 
 POLYMORPHIC_SETTER_DECLARE (void, GameClientRunner, addIwad,())
 
 POLYMORPHIC_SETTER_DECLARE (void, GameClientRunner, addPassword,())
 
 POLYMORPHIC_SETTER_DECLARE (void, GameClientRunner, createCommandLineArguments,())
 
ServerConnectParamsserverConnectParams ()
 Direct access to ServerConnectParams associated with current command line generation. More...
 
void setArgForBexLoading (const QString &arg)
 
void setArgForConnect (const QString &arg)
 
void setArgForConnectPassword (const QString &arg)
 
void setArgForDehLoading (const QString &arg)
 
void setArgForDemoRecord (const QString &arg)
 
void setArgForInGamePassword (const QString &arg)
 
void setArgForIwadLoading (const QString &arg)
 
void setArgForOptionalWadLoading (const QString &arg)
 
void setArgForPort (const QString &arg)
 
void setArgForPwadLoading (const QString &arg)
 
void setJoinError (const JoinError &e)
 Apply error that is passed to the launching routine and can be displayed to user. More...
 
QString wadTargetDirectory () const
 Directory where Doomseeker stores downloaded WADs. More...
 

Detailed Description

Creates command line that launches the client executable of the game and connects it to a server.

Basing on some input parameters object of this class fills out CommandLineInfo objects that can be used to launch games and connect them to game servers. GameClientRunner is connected to a Server object from which it originates and requires for that object to be valid.

Method of command line arguments generation can be customized either partially by replacing one of the virtual methods or fully by replacing createCommandLineArguments() method. In latter case it's entirely up to the plugin to fill out everything either by calling already defined protected methods or by filling out the CommandLineInfo struct on its own.

Definition at line 93 of file gameclientrunner.h.

Member Function Documentation

void GameClientRunner::addConnectCommand ( )
protected

[Virtual] Adds connection arguments to the list.

This is argForConnect() followed by server "ip:port".

void GameClientRunner::addCustomParameters ( )
protected

Adds custom parameters defined by user in configuration box to the args list.

Custom parameters are specified as a single string by the user, but they're split to separate arguments in a manner appropriate to given OS.

Definition at line 181 of file gameclientrunner.cpp.

void GameClientRunner::addDemoRecordCommand ( )
protected

Adds command for demo recording.

This is argForDemoRecord() followed by demoName().

Warning
This method doesn't check whether the demo name is empty and attempts to add the arguments anyway.

Definition at line 189 of file gameclientrunner.cpp.

void GameClientRunner::addExtra ( )
protected

[Virtual] Plugins can easily add plugin-specific arguments here.

This method is called at the end of "add stuff" chain in createCommandLineArguments().

void GameClientRunner::addGamePaths ( )
protected

Sets working directory and path to executable in out put CommandLineInfo.

Definition at line 194 of file gameclientrunner.cpp.

void GameClientRunner::addInGamePassword ( )
protected

[Virtual] Adds in-game password to the args list.

Adds argForInGamePassword() followed by inGamePassword().

Warning
This method doesn't check whether the password is empty and attempts to add the arguments anyway.
void GameClientRunner::addIwad ( )
protected

[Virtual] Plugins can replace IWAD discovery mechanism and generation of relevant executable parameters here.

This method supports WAD aliasing configured in Doomseeker.

void GameClientRunner::addPassword ( )
protected

[Virtual] Adds connect password to the args list.

This is argForConnectPassword() followed by connectPassword().

Warning
This method doesn't check whether the password is empty and attempts to add the arguments anyway.
void GameClientRunner::addPwads ( )
protected

Finds and adds each PWAD to the args list, marks missing WADs.

Properly found WADs are added to the args list. Each WAD argument is prepended with argForPwadLoading() argument.

Not found WADs are marked as such with markPwadAsMissing() method.

This method supports WAD aliasing configured in Doomseeker.

Definition at line 284 of file gameclientrunner.cpp.

void GameClientRunner::addWads ( )
protected

Calls addIwad() then addPwads(), sets JoinError::MissingWads in case of failure.

Definition at line 247 of file gameclientrunner.cpp.

const QString & GameClientRunner::argForConnect ( ) const
protected

Command line parameter that specifies the target server's IP and port.

Default: "-connect".

Definition at line 321 of file gameclientrunner.cpp.

const QString & GameClientRunner::argForConnectPassword ( ) const
protected

Command line parameter that is used to specify connection password.

There is no common value here so the default behavior returns a "null" string.

Definition at line 326 of file gameclientrunner.cpp.

const QString & GameClientRunner::argForDehLoading ( ) const
protected

Command line parameter that is used to load a DEHACKED file.

Default: "-deh".

Definition at line 331 of file gameclientrunner.cpp.

const QString & GameClientRunner::argForDemoRecord ( ) const
protected

Command line parameter for recording a demo.

Default: "-record";

Definition at line 361 of file gameclientrunner.cpp.

const QString & GameClientRunner::argForInGamePassword ( ) const
protected

Command line parameter that is used to specify in-game ("join") password.

There is no common value here so the default behavior returns a "null" string.

Definition at line 336 of file gameclientrunner.cpp.

const QString & GameClientRunner::argForIwadLoading ( ) const
protected

Command line parameter that is used to set IWAD.

Default: "-iwad".

Definition at line 341 of file gameclientrunner.cpp.

const QString & GameClientRunner::argForOptionalWadLoading ( ) const
protected

Command line parameter that is used to load optional WADs.

Default: "-file".

Definition at line 346 of file gameclientrunner.cpp.

const QString & GameClientRunner::argForPort ( ) const
protected

Command line parameter that is used to set internet port for the game.

Default: "-port".

Definition at line 351 of file gameclientrunner.cpp.

const QString & GameClientRunner::argForPwadLoading ( ) const
protected

Command line parameter that is used to load a PWAD.

Default: "-file".

Definition at line 356 of file gameclientrunner.cpp.

QStringList & GameClientRunner::args ( )
protected

Output command line arguments.

This is where plugins should write all CMD line arguments they create for the executable run.

Definition at line 311 of file gameclientrunner.cpp.

const QString & GameClientRunner::connectPassword ( ) const
protected

Password for server connection.

Definition at line 371 of file gameclientrunner.cpp.

void GameClientRunner::createCommandLineArguments ( )
protected

[Virtual] Spawns entire command line for client executable launch.

Default behavior splits the call between various "add*" methods. Plugins can customize behavior by either overwriting these "add*" methods that are virtual, or by overwriting this method and either writing the generation process from scratch or reusing the "add*" methods where applicable.

JoinError GameClientRunner::createJoinCommandLine ( CommandLineInfo cli,
const ServerConnectParams params 
)

Fills out CommandLineInfo object that allows client executables to be launched.

Parameters
[out]cliAfter successful call this will contain required command line information.
paramsConnection parameters specified through Doomseeker.
Returns
JoinError::type == NoError if all ok.

Definition at line 397 of file gameclientrunner.cpp.

const QString & GameClientRunner::demoName ( ) const
protected

Name of the demo if demo should be recorded, otherwise empty.

Definition at line 415 of file gameclientrunner.cpp.

QString GameClientRunner::findWad ( const QString &  wad) const
protected

Finds WAD in a way that supports user configured aliases.

Definition at line 425 of file gameclientrunner.cpp.

const QString & GameClientRunner::inGamePassword ( ) const
protected

"Join" password required in game.

Definition at line 472 of file gameclientrunner.cpp.

JoinError GameClientRunner::joinError ( ) const

JoinError set by last call to createJoinCommandLine().

Definition at line 580 of file gameclientrunner.cpp.

void GameClientRunner::markPwadAsMissing ( const PWad pwadName)
protected

Stores PWAD in an internal list of missing WADs.

This information is retrieved by Doomseeker to prompt user whether they want to try to download the WADs.

Definition at line 504 of file gameclientrunner.cpp.

PathFinder & GameClientRunner::pathFinder ( )
protected

Reference to a PathFinder belonging to this GameClientRunner.

Useful if plugins want to access the PathFinder.

Definition at line 509 of file gameclientrunner.cpp.

QString GameClientRunner::pathToOfflineExe ( Message msg)
protected

Retrieves path to offline exe from plugin's ExeFile.

Definition at line 514 of file gameclientrunner.cpp.

ServerConnectParams & GameClientRunner::serverConnectParams ( )
protected

Direct access to ServerConnectParams associated with current command line generation.

Definition at line 525 of file gameclientrunner.cpp.

void GameClientRunner::setJoinError ( const JoinError e)
protected

Apply error that is passed to the launching routine and can be displayed to user.

Definition at line 585 of file gameclientrunner.cpp.

QString GameClientRunner::wadTargetDirectory ( ) const
protected

Directory where Doomseeker stores downloaded WADs.

This can be useful for games that support in-game downloads.

Definition at line 595 of file gameclientrunner.cpp.


The documentation for this class was generated from the following files: