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... | |
GameMode (const GameMode &other) | |
gamemode_id | 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... | |
GameMode & | operator= (const GameMode &other) |
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... | |
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 372 of file serverstructs.h.
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 388 of file serverstructs.h.
GameMode::GameMode | ( | ) |
Constructs an invalid GameMode object.
|
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.
index | Value unique to given plugin but not within 900 - 1000 range. |
name | User-displayable name of the game mode. |
Definition at line 390 of file serverstructs.cpp.
gamemode_id GameMode::index | ( | ) | const |
Index, either a StandardGameMode or custom defined by plugin.
Definition at line 397 of file serverstructs.cpp.
bool GameMode::isTeamGame | ( | ) | const |
Is this GameMode based on rivaling teams?
Definition at line 432 of file serverstructs.cpp.
bool GameMode::isValid | ( | ) | const |
'Null' objects are invalid.
Definition at line 437 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 427 of file serverstructs.cpp.
|
static |
Game mode based on rivaling teams.
index | Value unique to given plugin but not within 900 - 1000 range. |
name | User-displayable name of the game mode. |
Definition at line 447 of file serverstructs.cpp.