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);
|
|
39 |
void AddTeam(const QString & team, unsigned char numHedgedogs);
|
|
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 |
void LocalCFG(quint8 num);
|
|
57 |
|
|
58 |
private:
|
|
59 |
enum GameType {
|
|
60 |
gtLocal = 1,
|
|
61 |
gtQLocal = 2,
|
|
62 |
gtDemo = 3,
|
|
63 |
gtNet = 4
|
|
64 |
};
|
|
65 |
char msgbuf[MAXMSGCHARS];
|
|
66 |
QString teams[5];
|
|
67 |
std::map<QString, unsigned char> hdNum;
|
|
68 |
QString seed;
|
|
69 |
int TeamCount;
|
|
70 |
GameUIConfig * config;
|
|
71 |
GameCFGWidget * gamecfg;
|
|
72 |
GameType gameType;
|
|
73 |
|
|
74 |
void SendConfig();
|
|
75 |
void SendQuickConfig();
|
|
76 |
void SendTeamConfig(int index);
|
|
77 |
void ParseMessage(const QByteArray & msg);
|
|
78 |
void SaveDemo(const QString & filename);
|
|
79 |
};
|
|
80 |
|
|
81 |
#endif
|