41 DMFlag::DMFlag(QString
name,
unsigned value)
68 DClass<DMFlagsSection>
72 QVector<DMFlag> flags;
81 DMFlagsSection::DMFlagsSection(
const QString&
name)
86 DMFlagsSection::~DMFlagsSection()
98 foreach (
const DMFlag& flag, d->flags)
100 result |= flag.
value();
107 return d->flags.count();
110 bool DMFlagsSection::isEmpty()
const
122 return d->flags[index];
127 return d->flags[index];
146 GameCVar::GameCVar(
const QString &
name,
const QString &command)
152 GameCVar::~GameCVar()
163 return value().isValid();
211 GameMode::~GameMode()
218 result.setTeamGame(
false);
229 return ffaGame(SGM_Cooperative, QObject::tr(
"Cooperative"));
234 return ffaGame(SGM_Deathmatch, QObject::tr(
"Deathmatch"));
237 GameMode GameMode::mkTeamDeathmatch()
239 return teamGame(SGM_TeamDeathmatch, QObject::tr(
"Team DM"));
242 GameMode GameMode::mkCaptureTheFlag()
244 return teamGame(SGM_CTF, QObject::tr(
"CTF"));
264 return !d->name.isEmpty();
267 void GameMode::setTeamGame(
bool b)
275 result.setTeamGame(
true);
293 d->optional = optional;
void add(const DMFlag &flag)
Append a new DMFlag to this section.
const QString & name() const
Nice name to display to user in Create Game dialog and in other widgets.
const QString & name() const
User-friendly name to display for game mode.
Impossible to determine the game mode.
static GameMode ffaGame(int index, const QString &name)
Construct a custom FFA game where players don't belong to any teams.
GameMode()
Constructs an invalid GameMode object.
void setValue(const QVariant &value)
Assign value() to this GameCVar.
bool isValid() const
'Null' objects are invalid.
A group of DMFlag objects that can be safely OR'ed together to form a meaningful value.
A game setting that is a part of a group of settings that can be OR'ed logically as a single integer...
const QVariant & value() const
Passed as the second argument, following command().
int count() const
Number of DMFlag objects inside the collection.
bool isTeamGame() const
Is this GameMode based on rivaling teams?
bool hasValue() const
Is any value assigned to this GameCVar.
bool isValid() const
'Null' objects are invalid.
const DMFlag & operator[](int index) const
Access DMFlag at specific index with '[]' operator.
const QString & name() const
Server's name.
Game mode representation.
unsigned combineValues() const
Logical OR of all DMFlag::value() results in this collection.
unsigned value() const
Bits that represent this flag (usually just a single '1' bit).
int index() const
Index, either a StandardGameMode or custom defined by plugin.
const QString & name() const
User-displayable name of this section, ex. "Compatibility flags".
bool isValid() const
Valid objects have value() greater than zero.
bool isOptional() const
Is this WAD required to join the server?
static GameMode teamGame(int index, const QString &name)
Game mode based on rivaling teams.
const QString & name() const
User-displayable name of the DMFlag, ex. "Jump is allowed".
A general game setting or variable (like fraglimit).
const QString & command() const
Command-line argument that sets this GameCVar.
const QString & name() const
File name of the WAD.