gamehost.h
1 //------------------------------------------------------------------------------
2 // gamehost.h
3 //------------------------------------------------------------------------------
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 // 02110-1301, USA.
19 //
20 //------------------------------------------------------------------------------
21 // Copyright (C) 2013 "Zalewa" <zalewapl@gmail.com>
22 //------------------------------------------------------------------------------
23 #ifndef idABA35264_C99B_49FA_BEDEDB4F5978C7EC
24 #define idABA35264_C99B_49FA_BEDEDB4F5978C7EC
25 
26 #include "dptr.h"
27 #include "global.h"
28 #include "serverapi/polymorphism.h"
29 #include <QObject>
30 #include <QStringList>
31 
32 class CommandLineInfo;
33 class EnginePlugin;
34 class GameCreateParams;
35 class Message;
36 
69 class MAIN_EXPORT GameHost : public QObject
70 {
71  Q_OBJECT
72 
73  public:
74  GameHost(EnginePlugin* plugin);
75  virtual ~GameHost();
76 
81  Message createHostCommandLine(const GameCreateParams& params, CommandLineInfo& cmdLine);
82 
86  Message host(const GameCreateParams& params);
87 
91  EnginePlugin* plugin() const;
92 
93  protected:
99  const QString& argForBexLoading() const;
100 
106  const QString& argForDehLoading() const;
107 
113  const QString& argForIwadLoading() const;
114 
120  const QString& argForOptionalWadLoading() const;
121 
128  const QString& argForPort() const;
129 
135  const QString& argForPwadLoading() const;
136 
142  const QString& argForDemoPlayback() const;
148  const QString& argForDemoRecord() const;
149 
155  const QString& argForServerLaunch() const;
156 
163  QStringList &args();
164 
169  virtual void addCustomParameters();
170 
177  void addDMFlags();
178  POLYMORPHIC_SETTER_DECLARE(void, GameHost, addDMFlags, ());
179  void addDMFlags_default();
180 
196  virtual void addExtra();
197 
201  void addIwad();
202  POLYMORPHIC_SETTER_DECLARE(void, GameHost, addIwad, ());
203  void addIwad_default();
204 
209  void addPwads();
210  POLYMORPHIC_SETTER_DECLARE(void, GameHost, addPwads, ());
211  void addPwads_default();
212 
223  virtual void createCommandLineArguments();
224 
229  const GameCreateParams& params() const;
230 
231  void setArgForBexLoading(const QString& arg);
232  void setArgForDehLoading(const QString& arg);
233  void setArgForIwadLoading(const QString& arg);
234  void setArgForOptionalWadLoading(const QString& arg);
235  void setArgForPort(const QString& arg);
236  void setArgForPwadLoading(const QString& arg);
237  void setArgForDemoPlayback(const QString& arg);
238  void setArgForDemoRecord(const QString& arg);
239  void setArgForServerLaunch(const QString& arg);
240 
248  void setMessage(const Message& message);
249 
250  private:
251  DPtr<GameHost> d;
252 
253  Q_DISABLE_COPY(GameHost);
254 
255  void addDemoPlaybackIfApplicable();
256  void addDemoRecordIfApplicable();
257  void saveDemoMetaData();
258  void setupGamePaths();
259 };
260 
261 #endif
Game parametrization data used when creating new games.
Structure holding parameters for application launch.
Definition: apprunner.h:37
Message object used to pass messages throughout the Doomseeker's system.
Definition: message.h:62
Creates game servers, offline games or demo playbacks.
Definition: gamehost.h:69