23 #include "gamecreateparams.h" 29 DClass<GameCreateParams>
33 bool broadcastToMaster;
34 QString connectPassword;
35 QStringList customParameters;
36 QList<GameCVar> cvars;
37 QString executablePath;
40 QList<DMFlagsSection> dmFlags;
43 GameCreateParams::HostMode hostMode;
44 QString ingamePassword;
53 QMap<QString, QVariant> options;
55 QList<bool> pwadsOptional;
56 QStringList pwadsPaths;
57 bool randomMapRotation;
69 d->broadcastToLan =
true;
70 d->broadcastToMaster =
true;
71 d->randomMapRotation =
false;
80 GameCreateParams::~GameCreateParams()
86 return d->connectPassword;
89 QStringList &GameCreateParams::customParameters()
91 return d->customParameters;
94 const QStringList &GameCreateParams::customParameters()
const 96 return d->customParameters;
116 return d->demoRecord;
119 void GameCreateParams::setDemoRecord(
const GameDemo &demo)
121 d->demoRecord = demo;
124 QList<DMFlagsSection> &GameCreateParams::dmFlags()
129 const QList<DMFlagsSection> &GameCreateParams::dmFlags()
const 134 const QString &GameCreateParams::email()
const 141 return d->executablePath;
144 const GameMode &GameCreateParams::gameMode()
const 149 GameCreateParams::HostMode GameCreateParams::hostMode()
const 154 bool GameCreateParams::isBroadcastToLan()
const 156 return d->broadcastToLan;
159 bool GameCreateParams::isBroadcastToMaster()
const 161 return d->broadcastToMaster;
164 bool GameCreateParams::isRandomMapRotation()
const 166 return d->randomMapRotation;
171 return d->ingamePassword;
174 const QString &GameCreateParams::iwadPath()
const 181 QFileInfo fi(iwadPath());
182 return fi.fileName();
187 return d->loggingPath;
200 int GameCreateParams::maxClients()
const 202 return d->maxClients;
205 int GameCreateParams::maxPlayers()
const 207 return d->maxPlayers;
212 return qMax(maxClients(), maxPlayers());
220 const QString &GameCreateParams::name()
const 227 return d->options[name];
230 void GameCreateParams::setOption(
const QString &name,
const QVariant &value)
232 d->options[name] = value;
235 unsigned short GameCreateParams::port()
const 240 QList<bool> &GameCreateParams::pwadsOptional()
242 return d->pwadsOptional;
245 const QList<bool> &GameCreateParams::pwadsOptional()
const 247 return d->pwadsOptional;
250 QStringList &GameCreateParams::pwadsPaths()
252 return d->pwadsPaths;
255 const QStringList &GameCreateParams::pwadsPaths()
const 257 return d->pwadsPaths;
263 for (
const QString &path : pwadsPaths())
266 result << fi.fileName();
275 for (
int i = 0; i < names.size(); ++i)
277 result <<
PWad(names[i], pwadsOptional()[i]);
284 return d->rconPassword;
287 void GameCreateParams::setBroadcastToLan(
bool b)
289 d->broadcastToLan = b;
292 void GameCreateParams::setBroadcastToMaster(
bool b)
294 d->broadcastToMaster = b;
297 void GameCreateParams::setConnectPassword(
const QString &pass)
299 d->connectPassword = pass;
302 void GameCreateParams::setCustomParameters(
const QStringList &customParameters)
304 d->customParameters = customParameters;
307 void GameCreateParams::setCvars(
const QList<GameCVar> &
cvars)
312 void GameCreateParams::setDemoPath(
const QString &
demoPath)
317 void GameCreateParams::setEmail(
const QString &email)
322 void GameCreateParams::setExecutablePath(
const QString &
executablePath)
327 void GameCreateParams::setGameMode(
const GameMode &mode)
332 void GameCreateParams::setHostMode(HostMode mode)
337 void GameCreateParams::setIngamePassword(
const QString &pass)
339 d->ingamePassword = pass;
342 void GameCreateParams::setIwadPath(
const QString &iwadPath)
344 d->iwadPath = iwadPath;
347 void GameCreateParams::setLoggingPath(
const QString &
loggingPath)
352 void GameCreateParams::setMap(
const QString &
map)
357 void GameCreateParams::setMapList(
const QStringList &
mapList)
362 void GameCreateParams::setMaxClients(
int num)
367 void GameCreateParams::setMaxPlayers(
int num)
372 void GameCreateParams::setMotd(
const QString &
motd)
377 void GameCreateParams::setName(
const QString &name)
382 void GameCreateParams::setPort(
unsigned short port)
387 void GameCreateParams::setPwadsOptional(
const QList<bool> &pwadsOptional)
389 d->pwadsOptional = pwadsOptional;
392 void GameCreateParams::setPwadsPaths(
const QStringList &pwadsPaths)
394 d->pwadsPaths = pwadsPaths;
397 void GameCreateParams::setRandomMapRotation(
bool b)
399 d->randomMapRotation = b;
402 void GameCreateParams::setRconPassword(
const QString &pass)
404 d->rconPassword = pass;
407 void GameCreateParams::setSkill(
int skill)
412 void GameCreateParams::setUrl(
const QString &
url)
427 void GameCreateParams::setUpnp(
bool upnp)
437 void GameCreateParams::setUpnpPort(quint16 port)
QStringList pwadsNames() const
Names of PWADs, derived from pwadsPaths().
const QString & connectPassword() const
Password that allows clients to connect to the server.
QList< PWad > pwads() const
PWad objects with just the file names and optional statuses.
const QString & ingamePassword() const
Internal game password.
Game parametrization data used when creating new games.
quint16 upnpPort() const
Game or plugin can use this network port as it sees fit within the UPnP context.
QString iwadName() const
Name of IWAD, derived from iwadPath().
const QString & motd() const
Message of the Day.
int maxTotalClientSlots() const
Derived basing on maxClients() and maxPlayers() value; higher value wins.
const QString & executablePath() const
Path to the game executable.
bool upnp() const
If set, the game should try to enable UPnP.
const QString & demoPath() const
Use if running in HostMode::Demo mode or recording a demo.
const QString & url() const
URL for server's website or for WADs download.
Game mode representation.
QVariant option(const QString &name) const
Option is a means for game plugin to set plugin specific settings.
const QString & loggingPath() const
Path to the directory where logs should be saved.
const QString & map() const
Level name as in E1M1 or MAP01.
QList< GameCVar > & cvars()
Contents of this list will be passed as "+consoleCommand value" to the command line.
const QString & rconPassword() const
Password required to connect to remote admin console.
int skill() const
Difficulty level.
const GameDemo & demoRecord() const
Type of demo to record; applicable only in Offline game.
const QStringList & mapList() const
List of maps in cycle, as in MAP01, MAP02, MAP03, and so on.