24 #include "gui/configuration/engineconfigpage.h" 26 #include "irc/entities/ircnetworkentity.h" 28 #include "pathfinder/pathfind.h" 29 #include "plugins/enginedefaults.h" 30 #include "plugins/engineplugin.h" 31 #include "serverapi/gameexefactory.h" 32 #include "serverapi/gamefile.h" 33 #include "serverapi/gamehost.h" 34 #include "serverapi/server.h" 35 #include "strings.hpp" 40 EnginePlugin::Data::Data()
43 allowsConnectPassword =
false;
44 allowsClientSlots =
true;
45 allowsPlayerSlots =
true;
47 allowsJoinPassword =
false;
49 allowsRConPassword =
false;
52 allowsUpnpPort =
false;
53 allowsLogging =
false;
57 defaultServerPort = 10666;
58 demoExtensionAutomatic =
true;
59 demoExtension =
"lmp";
63 inGameFileDownloads =
false;
64 masterClient =
nullptr;
67 supportsRandomMapRotation =
false;
75 EnginePlugin::EnginePlugin()
79 d->gameExeFactory = QSharedPointer<GameExeFactory>(
new GameExeFactory(
this));
84 d->abiVersion = DOOMSEEKER_ABI_VERSION;
87 EnginePlugin::~EnginePlugin()
101 return QList<DMFlagsSection>();
106 return data()->gameExeFactory.data();
116 return QList<GameMode>();
121 return QList<GameCVar>();
127 d->icon =
new QPixmap(icon);
128 d->scheme = QString(d->name).replace(
' ',
"");
134 while ((feature = va_arg(va,
int)) !=
EP_Done)
140 gLog << QString(
"%1 plugin attempted to use unknown feature.").arg(name);
145 d->author = va_arg(va,
const char *);
148 d->version = va_arg(va,
unsigned int);
155 d->allowsConnectPassword =
true;
158 d->allowsEmail =
true;
164 d->allowsJoinPassword =
true;
167 d->allowsLogging =
true;
170 d->allowsRConPassword =
true;
173 d->allowsMOTD =
true;
176 d->allowsUpnp =
true;
179 d->allowsUpnpPort =
true;
185 d->canonicalName = va_arg(va,
const char *);
188 d->clientOnly =
true;
191 d->defaultMaster = va_arg(va,
const char *);
194 d->defaultServerPort = va_arg(va,
unsigned int);
197 d->demoExtensionAutomatic = va_arg(va,
unsigned int);
198 d->demoExtension = va_arg(va,
const char *);
201 d->difficulty = QSharedPointer<GameCVarProvider>(va_arg(va,
GameCVarProvider *));
204 d->createDMFlagsPagesAutomatic =
false;
207 d->inGameFileDownloads =
true;
213 entity.setDescription(va_arg(va,
const char *));
214 entity.setAddress(va_arg(va,
const char *));
217 if (d->ircChannels.contains(entity))
219 IRCNetworkEntity &existingEntity = d->ircChannels[d->ircChannels.indexOf(entity)];
223 d->ircChannels << entity;
230 d->allowsClientSlots =
false;
233 d->allowsPlayerSlots =
false;
239 d->hasMapList =
false;
242 d->supportsRandomMapRotation =
true;
245 d->scheme = va_arg(va,
const char *);
248 d->refreshThreshold = va_arg(va,
unsigned int);
251 d->clientExeName = va_arg(va,
const char *);
254 d->serverExeName = va_arg(va,
const char *);
258 QString suffixes = va_arg(va,
const char *);
259 d->gameFileSearchSuffixes = suffixes.split(
";", QString::SkipEmptyParts);
270 QString str = d->pConfig->setting(
"Masterserver");
276 if (!d->canonicalName.isEmpty())
278 return d->canonicalName;
283 QString name = data()->name;
284 name = name.toLower();
285 name = name.replace(QRegExp(
"\\s"),
"_");
293 if (server !=
nullptr)
294 server->setSelf(server.toWeakRef());
313 void EnginePlugin::setGameExeFactory(QSharedPointer<GameExeFactory> factory)
315 d->gameExeFactory = factory;
318 void EnginePlugin::findGameFiles(
IniSection &ini)
320 for (
const GameFile &file : gameExe()->gameFiles().asQList())
324 QString path = PathFind::findGameFile(collectKnownPaths(ini), file);
330 QStringList EnginePlugin::collectKnownPaths(
const IniSection &ini)
const Disables specifying amount of player slots in create game box.
IniVariable createSetting(const QString &name, const QVariant &data)
Inits specified variable with specified data.
bool createDMFlagsPagesAutomatic
Controls behavior of "Create Game" dialog.
Informs that the game has no notion of an IWAD.
QPixmap * icon
icon of the engine
(const char*) Author of the plugin.
virtual QList< DMFlagsSection > dmFlags() const
Game settings flags.
static void translateServerAddress(const QString &addressString, QString &hostname, unsigned short &port, const QString &defaultAddress)
Translates string in format "hostname:port" to atomic values.
QScopedPointer< TextProvider > aboutProvider
Description of the plugin, intended to be displayed in the "About" dialog.
virtual void start()
Start services, init data structures.
virtual void setupConfig(IniSection &config)
Reimplement if you want to perform some ini initialization manually.
QSharedPointer< GameExeFactory > gameExeFactory
Factory of executable retrievers ExeFile objects.
Allows the player to join a server without downloading files through Wadseeker.
virtual ConfigPage * configuration(QWidget *parent)
Engine's configuration widget.
virtual ServerPtr mkServer(const QHostAddress &address, unsigned short port) const =0
Create an instance of local Server subclass and return a ServerPtr.
Tells the create game box that this game allows UPnP.
Signifies that servers can be created with a join password.
void init(const char *name, const char *const icon[],...)
virtual GameHost * gameHost()
Creates an instance of GameHost derivative class.
Signifies that a server can be created with a random map rotation.
const QString & configName() const
Setting name where path will be stored in plugin's IniSection.
const QStringList & autojoinChannels() const
List of channels to which a /join command will be issued automatically when a connection with this ne...
File name for game's server executable if game has any.
void masterHost(QString &host, unsigned short &port) const
Returns executable file retrievers from plugins to Doomseeker.
(const char*) Default ip address and port ("address:port") for master server. Requires EP_HasMasterSe...
(bool)auto, (const char*)extension Sets the extension that will be used for demos (default is true an...
bool hasSetting(const QString &name) const
true if setting of given name exists within the section.
GameCVarProvider that returns difficulty levels ordered from easiest to hardest.
Signifies that servers can be created for remote console access.
IniVariable retrieveSetting(const QString &name)
Gets a variable but only if it already exists.
virtual ServerPtr server(const QHostAddress &address, unsigned short port) const
Creates an instance of server object from this plugin.
Provides a description to be shown in the "About" menu.
File name for game's client (main) executable.
Tells the create game box that this game allows to modify UPnP port.
Signifies that servers can have a message of the day.
Signifies that servers can provide a URL for potential wad downloads.
Signals the end of init parameters.
(quint8) The amount of time (in seconds) that must pass before a server can be requeried.
Signifies that servers can be created with a connection password.
Disables map list in create game box.
virtual QList< GameMode > gameModes() const
Game modes (cooperative, deathmatch, ctf).
enables logging info (like console output) into a file. This will show the Logging section in the gen...
Signifies that servers can have an administrative contact email attached.
Data structure that describes and defines a connection to an IRC network or server.
virtual QList< GameCVar > gameModifiers() const
Modifier that apply to all game modes (ex. instagib).
INI section representation.
Indicates that client binary serves the purpose of the client and server.
Creates game servers, offline games or demo playbacks.
Game file definition allows to browse this file in configuration box.
(unsigned int) Single version number for plugin.
(quint16) Default port for custom server creation.
QString nameCanonical() const
Either specified explicitly by plugin or derived from the actual plugin name.
Abstract base for all MasterClients.
Default search suffixes used to automatically find game files.
(const char*)server, (const char*)channel - Can be repeated. Default IRC channels.
(const char*) Overrides the URL scheme which Doomseeker sets for this plugin. By default it is the po...
Base for configuration pages for plugins; provides some default behavior.
Plugin canonical name; should match filenames of the library and translation files.
QString defaultMaster
Default port on which servers for given engine are hosted.
Base class for configuration pages.
Disables specifying amount of client slots in create game box.