24 #include "gui/configuration/engineconfigpage.h" 26 #include "irc/entities/ircnetworkentity.h" 27 #include "pathfinder/pathfind.h" 28 #include "plugins/enginedefaults.h" 29 #include "plugins/engineplugin.h" 30 #include "serverapi/gameexefactory.h" 31 #include "serverapi/gamefile.h" 32 #include "serverapi/gamehost.h" 33 #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;
56 defaultServerPort = 10666;
57 demoExtensionAutomatic =
true;
58 demoExtension =
"lmp";
62 inGameFileDownloads =
false;
66 supportsRandomMapRotation =
false;
74 EnginePlugin::EnginePlugin()
78 d->gameExeFactory = QSharedPointer<GameExeFactory>(
new GameExeFactory(
this));
83 d->abiVersion = DOOMSEEKER_ABI_VERSION;
86 EnginePlugin::~EnginePlugin()
100 return QList<DMFlagsSection>();
105 return data()->gameExeFactory.data();
115 return QList<GameMode>();
120 return QList<GameCVar>();
126 d->icon =
new QPixmap(icon);
127 d->scheme = QString(d->name).replace(
' ',
"");
133 while((feature = va_arg(va,
int)) !=
EP_Done)
139 gLog << QString(
"%1 plugin attempted to use unknown feature.").arg(name);
144 d->author = va_arg(va,
const char*);
147 d->version = va_arg(va,
unsigned int);
154 d->allowsConnectPassword =
true;
157 d->allowsEmail =
true;
163 d->allowsJoinPassword =
true;
166 d->allowsRConPassword =
true;
169 d->allowsMOTD =
true;
172 d->allowsUpnp =
true;
175 d->allowsUpnpPort =
true;
181 d->canonicalName = va_arg(va,
const char*);
184 d->clientOnly =
true;
187 d->defaultMaster = va_arg(va,
const char*);
190 d->defaultServerPort = va_arg(va,
unsigned int);
193 d->demoExtensionAutomatic = va_arg(va,
unsigned int);
194 d->demoExtension = va_arg(va,
const char*);
197 d->difficulty = QSharedPointer<GameCVarProvider>(va_arg(va,
GameCVarProvider*));
200 d->createDMFlagsPagesAutomatic =
false;
203 d->inGameFileDownloads =
true;
209 entity.setDescription(va_arg(va,
const char*));
210 entity.setAddress(va_arg(va,
const char*));
213 if(d->ircChannels.contains(entity))
215 IRCNetworkEntity &existingEntity = d->ircChannels[d->ircChannels.indexOf(entity)];
219 d->ircChannels << entity;
226 d->allowsClientSlots =
false;
229 d->allowsPlayerSlots =
false;
235 d->hasMapList =
false;
238 d->supportsRandomMapRotation =
true;
241 d->scheme = va_arg(va,
const char*);
244 d->refreshThreshold = va_arg(va,
unsigned int);
247 d->clientExeName = va_arg(va,
const char*);
250 d->serverExeName = va_arg(va,
const char*);
254 QString suffixes = va_arg(va,
const char*);
255 d->gameFileSearchSuffixes = suffixes.split(
";", QString::SkipEmptyParts);
266 QString str = d->pConfig->setting(
"Masterserver");
272 if (!d->canonicalName.isEmpty())
274 return d->canonicalName;
279 QString name = data()->name;
280 name = name.toLower();
281 name = name.replace(QRegExp(
"\\s"),
"_");
289 server->setSelf(server.toWeakRef());
307 void EnginePlugin::setGameExeFactory(QSharedPointer<GameExeFactory> factory)
309 d->gameExeFactory = factory;
312 void EnginePlugin::findGameFiles(
IniSection &ini)
314 foreach (
const GameFile &file, gameExe()->gameFiles().asQList())
318 QString path = PathFind::findGameFile(collectKnownPaths(ini), file);
324 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 ServerPtr mkServer(const QHostAddress &address, unsigned short port) const =0
Create an instance of local Server subclass and return a ServerPtr.
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.
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 taht 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).
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.