src/core/serverapi/gamerunner.h
00001 //------------------------------------------------------------------------------
00002 // gamerunner.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) 2010 "Zalewa" <zalewapl@gmail.com>
00022 //------------------------------------------------------------------------------
00023 #ifndef __GAME_RUNNER_H_
00024 #define __GAME_RUNNER_H_
00025 
00026 #include "serverapi/gamerunnerstructs.h"
00027 #include "apprunner.h"
00028 #include "global.h"
00029 #include "pathfinder.h"
00030 #include <QObject>
00031 #include <QString>
00032 
00033 class Server;
00034 
00035 class MAIN_EXPORT GameRunner : public QObject
00036 {
00037         public:
00038                 enum HostMode
00039                 {
00040                         HOST,
00041                         OFFLINE,
00042                         DEMO
00043                 };
00044 
00045                 GameRunner(const Server* server);
00046 
00050                 virtual bool                            connectParameters(QStringList &args, PathFinder &pf, bool &iwadFound, const QString &connectPassword, const QString &wadTargetDirectory);
00051 
00061                 Message                                         createHostCommandLine(const HostInfo& hostInfo, CommandLineInfo& cmdLine, HostMode mode);
00062 
00068                 JoinError                                       createJoinCommandLine(CommandLineInfo& cli, const QString &connectPassword);
00069 
00073                 Message                                         host(const HostInfo& hostInfo, HostMode mode);
00074 
00082                 Message                                         runExecutable(const CommandLineInfo& cli, bool bWrapWithStandardServerConsole);
00083 
00084 
00085         protected:
00090                 virtual QString                         argForConnect() const { return "-connect"; }
00091 
00099                 virtual QString                         argForConnectPassword() const { return QString(); }
00100 
00104                 virtual QString                         argForIwadLoading() const { return "-iwad"; }
00105 
00110                 virtual QString                         argForPort() const { return "-port"; }
00111 
00115                 virtual QString                         argForPwadLoading() const { return "-file"; }
00116 
00120                 virtual QString                         argForDemoPlayback() const { return "-playdemo"; }
00124                 virtual QString                         argForDemoRecord() const { return "-record"; }
00125 
00129                 virtual QString                         argForServerLaunch() const { return ""; }
00130 
00131                 virtual Message                         hostAppendIwad();
00132                 virtual Message                         hostAppendPwads();
00133                 virtual Message                         hostGetBinary(bool bOfflinePlay);
00134                 virtual Message                         hostGetWorkingDirectory(bool bOfflinePlay);
00135 
00141                 virtual void                            hostDMFlags(QStringList& args, const DMFlags& dmFlags) const {};
00142 
00151                 virtual void                            hostProperties(QStringList& args) const {};
00152 
00153                 CommandLineInfo*                        currentCmdLine;
00154                 const HostInfo*                         currentHostInfo;
00155                 const Server*                           server;
00156 };
00157 
00158 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator