GameFile Class Reference

Game file definition allows to browse this file in configuration box. More...

#include <gamefile.h>

Public Types

enum  ExecType {
  Client = 0x1, Server = 0x2, Offline = 0x4, Cso = Client | Server | Offline,
  CreateGame = Server | Offline
}
 Executable types recognised by Doomseeker. More...
 

Public Member Functions

 GameFile (const GameFile &other)
 
const QString & configName () const
 Setting name where path will be stored in plugin's IniSection.
 
int executable () const
 Executable bit flags mod that compares to ExecType.
 
const QString & fileName () const
 Name of the file on disk.
 
bool isSameFile (const QString &otherFileName)
 Guesses by file name if this is the same file.
 
bool isValid () const
 A valid file has configName().
 
const QString & niceName () const
 Descriptive name, ie. "client executable", "server executable", etc.
 
GameFileoperator= (const GameFile &other)
 
QStringList & searchSuffixes () const
 Path suffixes that help in automatically finding this file.
 
GameFilesetConfigName (const QString &name)
 
GameFilesetExecutable (int flags)
 
GameFilesetFileName (const QString &name)
 
GameFilesetNiceName (const QString &name)
 
GameFilesetSearchSuffixes (const QStringList &suffixes)
 

Detailed Description

Game file definition allows to browse this file in configuration box.

There are some standard values for configName() property:

  • BinaryPath is the general game executable path. It's always used as the client executable when joining servers and as offline game executable. It can also be used to host servers if EnginePlugin::Data::clientOnly is true.
  • ServerBinaryPath is path to server executable. It's used when EnginePlugin::Data::clientOnly is false.

Apart from these, the configName can be anything you want and anything your plugin needs. Remember however that choosing a distinct name is important to avoid collisions with any future standard names.

There are three types of executables recognised by Doomseeker: isClientExecutable(), isServerExecutable() and isOfflineExecutable(). One executable can be all of these at the same time or the game might have separate executables for each mode. Setting one of these to true also implies isExecutable(). If plugin doesn't specify its own list of GameFile then Doomseeker will assume some defaults depending on plugin's EP_ClientOnly flag. The defaults are as follows:

  • If plugin defines EP_ClientOnly flag then there's only one executable that is all: client, server and offline.
  • If plugin doesn't define EP_ClientOnly then there are two executables: client executable that is both for client and offline modes and server executable that is only for hosting (possibly just a console).

This class follows Builder pattern. All setters return reference to the called object so that you can chain them together.

GameFile file;
return file.setNiceName(tr("client")).setConfigName("BinaryPath")
.setFileName("rungame").setExecutable(true);

Definition at line 72 of file gamefile.h.

Member Function Documentation

const QString & GameFile::configName ( ) const

Setting name where path will be stored in plugin's IniSection.

Definition at line 60 of file gamefile.cpp.

int GameFile::executable ( ) const

Executable bit flags mod that compares to ExecType.

Definition at line 82 of file gamefile.cpp.

const QString & GameFile::fileName ( ) const

Name of the file on disk.

Platform specific extensions (.exe) are unnecessary.

Definition at line 71 of file gamefile.cpp.

bool GameFile::isSameFile ( const QString &  otherFileName)

Guesses by file name if this is the same file.

Definition at line 93 of file gamefile.cpp.

bool GameFile::isValid ( ) const

A valid file has configName().

Definition at line 108 of file gamefile.cpp.

const QString & GameFile::niceName ( ) const

Descriptive name, ie. "client executable", "server executable", etc.

Definition at line 113 of file gamefile.cpp.

QStringList & GameFile::searchSuffixes ( ) const

Path suffixes that help in automatically finding this file.

See Also
EnginePlugin::InitFeatures::EP_GameFileSearchSuffixes.

Definition at line 124 of file gamefile.cpp.


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