Doomseeker
   
  • Doomseeker
  • Wadseeker
  • Download
  • Tracker
  • Git
  • Docs
  • Main Page
  • Classes
  • Files
  • File List
  • File Members

src/core/plugins/engineplugin.h

00001 //------------------------------------------------------------------------------
00002 // engineplugin.h
00003 //------------------------------------------------------------------------------
00004 //
00005 // This program is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU General Public License
00007 // as published by the Free Software Foundation; either version 2
00008 // of the License, or (at your option) any later version.
00009 //
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00018 // 02110-1301, USA.
00019 //
00020 //------------------------------------------------------------------------------
00021 // Copyright (C) 2011 "Blzut3" <admin@maniacsvault.net>
00022 //------------------------------------------------------------------------------
00023 
00024 #ifndef __ENGINEPLUGIN_H__
00025 #define __ENGINEPLUGIN_H__
00026 
00027 #include <QtContainerFwd>
00028 #include <QString>
00029 #include <QVector>
00030 #include "global.h"
00031 #include "serverapi/serverstructs.h"
00032 
00033 // Bump whenever the ABI changes in order to reject old plugins
00034 #define DOOMSEEKER_ABI_VERSION 1
00035 
00036 #define DECLARE_PLUGIN(XEnginePlugin) \
00037         public: \
00038                 static EnginePlugin *staticInstance() { return &__Static_Instance; } \
00039         protected: \
00040                 static XEnginePlugin __Static_Instance;
00041 
00042 #define INSTALL_PLUGIN(XEnginePlugin) \
00043         XEnginePlugin XEnginePlugin::__Static_Instance; \
00044         extern "C" PLUGIN_EXPORT unsigned int doomSeekerABI() { return DOOMSEEKER_ABI_VERSION; } \
00045         extern "C" PLUGIN_EXPORT EnginePlugin *doomSeekerInit() \
00046         { \
00047                 return XEnginePlugin::staticInstance(); \
00048         }
00049 
00050 class Binaries;
00051 class ConfigurationBaseBox;
00052 class CreateServerDialog;
00053 class CreateServerDialogPage;
00054 class GameCVar;
00055 class GameMode;
00056 class IniSection;
00057 class IRCNetworkEntity;
00058 class MasterClient;
00059 class Server;
00060 class QHostAddress;
00061 class QPixmap;
00062 class QWidget;
00063 
00064 class MAIN_EXPORT EnginePlugin
00065 {
00066         protected:
00072                 enum InitFeatures
00073                 {
00074                         EP_Done, 
00075 
00076                         EP_Author, 
00077                         EP_Version, 
00078 
00079                         EP_AllDMFlags, 
00080                         EP_AllowsConnectPassword, 
00081                         EP_AllowsEmail, 
00082                         EP_AllowsURL, 
00083                         EP_AllowsJoinPassword, 
00084                         EP_AllowsRConPassword, 
00085                         EP_AllowsMOTD, 
00086                         EP_DefaultMaster, 
00087                         EP_DefaultServerPort, 
00088                         EP_GameModes, 
00089                         EP_GameModifiers, 
00090                         EP_HasMasterServer, 
00091                         EP_InGameFileDownloads, 
00092                         EP_IRCChannel, 
00093                         EP_SupportsRandomMapRotation, 
00094                         EP_RefreshThreshold, 
00095                         EP_URLScheme, 
00096                         EP_DemoExtension, 
00097 
00106                         EP_DontCreateDMFlagsPagesAutomatic,
00107                         EP_ClientOnly 
00108                 };
00109 
00111                 virtual void                                                    setupConfig(IniSection &config) const {}
00112 
00113         public:
00118                 class Data
00119                 {
00120                         public:
00121                                 unsigned int                    abiVersion;
00123                                 const DMFlags*                  allDMFlags;
00124                                 bool                                    allowsConnectPassword;
00125                                 bool                                    allowsEmail;
00126                                 bool                                    allowsJoinPassword;
00127                                 bool                                    allowsMOTD;
00128                                 bool                                    allowsRConPassword;
00129                                 bool                                    allowsURL;
00130                                 QString                                 author;
00132                                 QString                                 defaultMaster;
00133                                 quint16                                 defaultServerPort;
00135                                 const QList<GameMode>*  gameModes;
00143                                 const QList<GameCVar>*  gameModifiers;
00144                                 bool                                    hasMasterServer;
00146                                 QPixmap                                 *icon;
00147                                 bool                                    inGameFileDownloads;
00148                                 QVector<IRCNetworkEntity> ircChannels;
00149                                 QString                                 name;
00150                                 IniSection                              *pConfig;
00151                                 quint8                                  refreshThreshold;
00152                                 QString                                 scheme;
00153                                 bool                                    supportsRandomMapRotation;
00154                                 bool                                    valid;
00155                                 unsigned int                    version;
00156                                 bool                                    demoExtensionAutomatic;
00157                                 QString                                 demoExtension;
00168                                 bool                                    createDMFlagsPagesAutomatic;
00169                                 bool                                    clientOnly;
00170 
00171                                 Data();
00172                 };
00173 
00174                 EnginePlugin();
00175                 virtual ~EnginePlugin();
00176 
00186                 void init(const char* name, const char* const icon[], ...);
00187 
00191                 virtual ConfigurationBaseBox*   configuration(QWidget *parent) const;
00192 
00210                 virtual QList<CreateServerDialogPage*> createServerDialogPages(
00211                         CreateServerDialog* pDialog)
00212                 {
00213                         return QList<CreateServerDialogPage*>();
00214                 }
00215 
00216                 const Data                                              *data() const { return d; }
00217                 const QPixmap                                   &icon() const { return *d->icon; }
00218                 void                                                    setConfig(IniSection &cfg) const;
00219 
00224                 virtual QList<GameCVar>                 limits(const GameMode& mode) const { return QList<GameCVar>(); }
00225 
00229                 virtual MasterClient*                   masterClient() const { return NULL; }
00233                 void                                                    masterHost(QString &host, unsigned short &port) const;
00234 
00240                 virtual Server*                                 server(const QHostAddress &address, unsigned short port) const = 0;
00241 
00242         private:
00243                 Data    *d;
00244 };
00245 
00246 #endif
   
Doomseeker © 2009-2024 The Doomseeker Team