184
|
1 |
/*
|
|
2 |
* Hedgewars, a worms-like game
|
|
3 |
* Copyright (c) 2005, 2006 Andrey Korotaev <unC0Rr@gmail.com>
|
|
4 |
*
|
|
5 |
* This program is free software; you can redistribute it and/or modify
|
|
6 |
* it under the terms of the GNU General Public License as published by
|
|
7 |
* the Free Software Foundation; version 2 of the License
|
|
8 |
*
|
|
9 |
* This program is distributed in the hope that it will be useful,
|
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12 |
* GNU General Public License for more details.
|
|
13 |
*
|
|
14 |
* You should have received a copy of the GNU General Public License
|
|
15 |
* along with this program; if not, write to the Free Software
|
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
|
17 |
*/
|
|
18 |
|
|
19 |
#ifndef GAME_H
|
|
20 |
#define GAME_H
|
|
21 |
|
|
22 |
#include <QObject>
|
|
23 |
#include <QByteArray>
|
|
24 |
#include <QString>
|
|
25 |
#include "team.h"
|
|
26 |
|
|
27 |
#include <map>
|
|
28 |
|
|
29 |
#include "tcpBase.h"
|
|
30 |
|
|
31 |
class GameUIConfig;
|
|
32 |
class GameCFGWidget;
|
|
33 |
|
|
34 |
class HWGame : public TCPBase
|
|
35 |
{
|
|
36 |
Q_OBJECT
|
|
37 |
public:
|
|
38 |
HWGame(GameUIConfig * config, GameCFGWidget * gamecfg);
|
213
|
39 |
void AddTeam(const QString & team, HWTeamTempParams teamParams);
|
184
|
40 |
void PlayDemo(const QString & demofilename);
|
|
41 |
void StartLocal();
|
|
42 |
void StartQuick();
|
|
43 |
void StartNet();
|
|
44 |
|
|
45 |
protected:
|
|
46 |
virtual QStringList setArguments();
|
|
47 |
virtual void onClientRead();
|
|
48 |
virtual void onClientDisconnect();
|
|
49 |
|
|
50 |
signals:
|
|
51 |
void SendNet(const QByteArray & msg);
|
|
52 |
|
|
53 |
public slots:
|
|
54 |
void FromNet(const QByteArray & msg);
|
|
55 |
void LocalCFG(const QString & teamname);
|
|
56 |
|
|
57 |
private:
|
|
58 |
enum GameType {
|
|
59 |
gtLocal = 1,
|
|
60 |
gtQLocal = 2,
|
|
61 |
gtDemo = 3,
|
|
62 |
gtNet = 4
|
|
63 |
};
|
|
64 |
char msgbuf[MAXMSGCHARS];
|
|
65 |
QString teams[5];
|
213
|
66 |
std::map<QString, HWTeamTempParams> m_teamsParams;
|
184
|
67 |
QString seed;
|
|
68 |
int TeamCount;
|
|
69 |
GameUIConfig * config;
|
|
70 |
GameCFGWidget * gamecfg;
|
|
71 |
GameType gameType;
|
|
72 |
|
|
73 |
void SendConfig();
|
|
74 |
void SendQuickConfig();
|
|
75 |
void SendTeamConfig(int index);
|
|
76 |
void ParseMessage(const QByteArray & msg);
|
|
77 |
void SaveDemo(const QString & filename);
|
|
78 |
};
|
|
79 |
|
|
80 |
#endif
|