gamehost.h
1 //------------------------------------------------------------------------------
2 // gamehost.h
3 //------------------------------------------------------------------------------
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library 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 GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; 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 
205  void addGlobalGameCustomParameters();
206  POLYMORPHIC_SETTER_DECLARE(void, GameHost, addGlobalGameCustomParameters, ());
207  void addGlobalGameCustomParameters_default();
208 
212  void addIwad();
213  POLYMORPHIC_SETTER_DECLARE(void, GameHost, addIwad, ());
214  void addIwad_default();
215 
220  void addPwads();
221  POLYMORPHIC_SETTER_DECLARE(void, GameHost, addPwads, ());
222  void addPwads_default();
226  void addPwads_prefixOnce();
227 
238  virtual void createCommandLineArguments();
239 
244  const GameCreateParams& params() const;
245 
246  void setArgForBexLoading(const QString& arg);
247  void setArgForDehLoading(const QString& arg);
248  void setArgForIwadLoading(const QString& arg);
249  void setArgForOptionalWadLoading(const QString& arg);
250  void setArgForPort(const QString& arg);
251  void setArgForPwadLoading(const QString& arg);
252  void setArgForDemoPlayback(const QString& arg);
253  void setArgForDemoRecord(const QString& arg);
254  void setArgForServerLaunch(const QString& arg);
255 
263  void setMessage(const Message& message);
264 
274  bool verifyPwadPaths();
275 
276  private:
277  DPtr<GameHost> d;
278 
279  Q_DISABLE_COPY(GameHost);
280 
281  void addDemoPlaybackIfApplicable();
282  void addDemoRecordIfApplicable();
283  QString fileLoadingPrefix(int index) const;
284  void saveDemoMetaData();
285  void setupGamePaths();
286 };
287 
288 #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&#39;s system.
Definition: message.h:63
Creates game servers, offline games or demo playbacks.
Definition: gamehost.h:69