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" 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;
73 EnginePlugin::EnginePlugin()
77 d->gameExeFactory = QSharedPointer<GameExeFactory>(
new GameExeFactory(
this));
82 d->abiVersion = DOOMSEEKER_ABI_VERSION;
85 EnginePlugin::~EnginePlugin()
99 return QList<DMFlagsSection>();
104 return data()->gameExeFactory.data();
114 return QList<GameMode>();
119 return QList<GameCVar>();
125 d->icon =
new QPixmap(icon);
126 d->scheme = QString(d->name).replace(
' ',
"");
132 while((feature = va_arg(va,
int)) !=
EP_Done)
138 gLog << QString(
"%1 plugin attempted to use unknown feature.").arg(name);
143 d->author = va_arg(va,
const char*);
146 d->version = va_arg(va,
unsigned int);
150 d->allowsConnectPassword =
true;
153 d->allowsEmail =
true;
159 d->allowsJoinPassword =
true;
162 d->allowsRConPassword =
true;
165 d->allowsMOTD =
true;
168 d->allowsUpnp =
true;
171 d->allowsUpnpPort =
true;
177 d->clientOnly =
true;
180 d->defaultMaster = va_arg(va,
const char*);
183 d->defaultServerPort = va_arg(va,
unsigned int);
186 d->demoExtensionAutomatic = va_arg(va,
unsigned int);
187 d->demoExtension = va_arg(va,
const char*);
190 d->difficulty = QSharedPointer<GameCVarProvider>(va_arg(va,
GameCVarProvider*));
193 d->createDMFlagsPagesAutomatic =
false;
196 d->inGameFileDownloads =
true;
202 entity.setDescription(va_arg(va,
const char*));
203 entity.setAddress(va_arg(va,
const char*));
206 if(d->ircChannels.contains(entity))
208 IRCNetworkEntity &existingEntity = d->ircChannels[d->ircChannels.indexOf(entity)];
212 d->ircChannels << entity;
219 d->allowsClientSlots =
false;
222 d->allowsPlayerSlots =
false;
228 d->hasMapList =
false;
231 d->supportsRandomMapRotation =
true;
234 d->scheme = va_arg(va,
const char*);
237 d->refreshThreshold = va_arg(va,
unsigned int);
240 d->clientExeName = va_arg(va,
const char*);
243 d->serverExeName = va_arg(va,
const char*);
247 QString suffixes = va_arg(va,
const char*);
248 d->gameFileSearchSuffixes = suffixes.split(
";", QString::SkipEmptyParts);
259 QString str = d->pConfig->setting(
"Masterserver");
265 QString name = data()->name;
266 name = name.toLower();
267 name = name.replace(QRegExp(
"\\s"),
"_");
274 server->setSelf(server.toWeakRef());
292 void EnginePlugin::setGameExeFactory(QSharedPointer<GameExeFactory> factory)
294 d->gameExeFactory = factory;
297 void EnginePlugin::findGameFiles(
IniSection &ini)
299 foreach (
const GameFile &file, gameExe()->gameFiles().asQList())
303 QString path = PathFind::findGameFile(collectKnownPaths(ini), file);
309 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.
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.
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
Derived from 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.
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.