GameMode Class Reference

Game mode representation. More...

#include <serverstructs.h>

Public Types

enum  StandardGameMode {
  SGM_Cooperative = 900, SGM_Deathmatch = 901, SGM_TeamDeathmatch = 902, SGM_CTF = 903,
  SGM_Unknown = 904
}
 These game modes are so common that Doomseeker represents them through internal values and static methods. More...
 

Public Member Functions

 GameMode ()
 Constructs an invalid GameMode object. More...
 
int index () const
 Index, either a StandardGameMode or custom defined by plugin. More...
 
bool isTeamGame () const
 Is this GameMode based on rivaling teams? More...
 
bool isValid () const
 'Null' objects are invalid. More...
 
const QString & name () const
 User-friendly name to display for game mode. More...
 

Static Public Member Functions

static GameMode ffaGame (int index, const QString &name)
 Construct a custom FFA game where players don't belong to any teams. More...
 
static GameMode mkCaptureTheFlag ()
 
static GameMode mkCooperative ()
 
static GameMode mkDeathmatch ()
 
static GameMode mkTeamDeathmatch ()
 
static GameMode mkUnknown ()
 
static GameMode teamGame (int index, const QString &name)
 Game mode based on rivaling teams. More...
 

Detailed Description

Game mode representation.

The only available constructor will create an invalid object (returns false on isValid()). The proper method of construction is to use provided static builder methods. Either use one of 'mk' methods, that are mentioned in StandardGameMode description, or build your own mode using ffaGame() or teamGame() methods. index() in all cases must either be one of StandardGameMode values or unique within your plugin for given game mode.

This object is safe to copy.

Definition at line 205 of file serverstructs.h.

Member Enumeration Documentation

These game modes are so common that Doomseeker represents them through internal values and static methods.

If your plugin recognizes that the server uses one of these game modes it's much better to use these values instead of implementing your own representation.

More importantly, static builder methods have been provided that already create appropriate GameMode objects. These methods are: mkCooperative(), mkDeathmatch(), mkTeamDeathmatch(), mkCaptureTheFlag(), and mkUnknown().

Enumerator
SGM_Unknown 

Impossible to determine the game mode.

Definition at line 221 of file serverstructs.h.

Constructor & Destructor Documentation

GameMode::GameMode ( )

Constructs an invalid GameMode object.

Member Function Documentation

GameMode GameMode::ffaGame ( int  index,
const QString &  name 
)
static

Construct a custom FFA game where players don't belong to any teams.

Cooperative game modes like "coop", "survival" or "invasion" are also considered as FFA.

Parameters
indexValue unique to given plugin but not within 900 - 1000 range.
nameUser-displayable name of the game mode.
See Also
teamGame()

Definition at line 215 of file serverstructs.cpp.

int GameMode::index ( ) const

Index, either a StandardGameMode or custom defined by plugin.

Definition at line 222 of file serverstructs.cpp.

bool GameMode::isTeamGame ( ) const

Is this GameMode based on rivaling teams?

Definition at line 257 of file serverstructs.cpp.

bool GameMode::isValid ( ) const

'Null' objects are invalid.

Definition at line 262 of file serverstructs.cpp.

const QString & GameMode::name ( ) const

User-friendly name to display for game mode.

This should be fairly short about no longer than "cooperative".

Definition at line 252 of file serverstructs.cpp.

GameMode GameMode::teamGame ( int  index,
const QString &  name 
)
static

Game mode based on rivaling teams.

Parameters
indexValue unique to given plugin but not within 900 - 1000 range.
nameUser-displayable name of the game mode.
See Also
ffaGame()

Definition at line 272 of file serverstructs.cpp.


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