author | nemo |
Fri, 05 Feb 2010 13:32:57 +0000 | |
changeset 2760 | 420fe0344e5f |
parent 2468 | 0b62498c201a |
child 2948 | 3f21a9dc93d0 |
permissions | -rw-r--r-- |
184 | 1 |
/* |
1066 | 2 |
* Hedgewars, a free turn based strategy game |
883 | 3 |
* Copyright (c) 2005-2008 Andrey Korotaev <unC0Rr@gmail.com> |
184 | 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 <QString> |
|
23 |
#include "team.h" |
|
1907 | 24 |
#include "namegen.h" |
184 | 25 |
|
26 |
#include "tcpBase.h" |
|
27 |
||
28 |
class GameUIConfig; |
|
29 |
class GameCFGWidget; |
|
339
7535ab6c3820
Run game message added, team and config info provided for net game
displacer
parents:
324
diff
changeset
|
30 |
class TeamSelWidget; |
184 | 31 |
|
306 | 32 |
enum GameState { |
33 |
gsNotStarted = 0, |
|
34 |
gsStarted = 1, |
|
324
f4c109c82a0c
Don't show game stats in case of interrupted by command '/quit' game
unc0rr
parents:
306
diff
changeset
|
35 |
gsInterrupted = 2, |
f4c109c82a0c
Don't show game stats in case of interrupted by command '/quit' game
unc0rr
parents:
306
diff
changeset
|
36 |
gsFinished = 3, |
686 | 37 |
gsStopped = 4, |
38 |
gsDestroyed = 5 |
|
306 | 39 |
}; |
40 |
||
41 |
||
184 | 42 |
class HWGame : public TCPBase |
43 |
{ |
|
44 |
Q_OBJECT |
|
45 |
public: |
|
681 | 46 |
HWGame(GameUIConfig * config, GameCFGWidget * gamecfg, QString ammo, TeamSelWidget* pTeamSelWidget = 0); |
419
fdeed9718e6b
virtual destructors for tcpBase derived classes, readarray clear removed as unneeded
displacer
parents:
395
diff
changeset
|
47 |
virtual ~HWGame(); |
341 | 48 |
void AddTeam(const QString & team); |
184 | 49 |
void PlayDemo(const QString & demofilename); |
50 |
void StartLocal(); |
|
51 |
void StartQuick(); |
|
52 |
void StartNet(); |
|
2468
0b62498c201a
openal fix, training map selection and rcplane adjustments from Smaxx (untested, but look reasonable). Bunch of new graphics from Tiy, new translation for pt-pt from inu_
nemo
parents:
2403
diff
changeset
|
53 |
void StartTraining(const QString & file); |
184 | 54 |
|
55 |
protected: |
|
56 |
virtual QStringList setArguments(); |
|
57 |
virtual void onClientRead(); |
|
58 |
virtual void onClientDisconnect(); |
|
59 |
||
60 |
signals: |
|
61 |
void SendNet(const QByteArray & msg); |
|
1356 | 62 |
void SendChat(const QString & msg); |
2403 | 63 |
void SendTeamMessage(const QString & msg); |
306 | 64 |
void GameStateChanged(GameState gameState); |
65 |
void GameStats(char type, const QString & info); |
|
533 | 66 |
void HaveRecord(bool isDemo, const QByteArray & record); |
425 | 67 |
void ErrorMessage(const QString &); |
184 | 68 |
|
69 |
public slots: |
|
70 |
void FromNet(const QByteArray & msg); |
|
1356 | 71 |
void FromNetChat(const QString & msg); |
184 | 72 |
|
73 |
private: |
|
1375 | 74 |
enum GameType { |
75 |
gtLocal = 1, |
|
76 |
gtQLocal = 2, |
|
77 |
gtDemo = 3, |
|
78 |
gtNet = 4, |
|
79 |
gtTraining = 5 |
|
184 | 80 |
}; |
81 |
char msgbuf[MAXMSGCHARS]; |
|
82 |
QString teams[5]; |
|
681 | 83 |
QString ammostr; |
184 | 84 |
int TeamCount; |
85 |
GameUIConfig * config; |
|
86 |
GameCFGWidget * gamecfg; |
|
339
7535ab6c3820
Run game message added, team and config info provided for net game
displacer
parents:
324
diff
changeset
|
87 |
TeamSelWidget* m_pTeamSelWidget; |
184 | 88 |
GameType gameType; |
533 | 89 |
GameState gameState; |
184 | 90 |
|
253 | 91 |
void commonConfig(); |
184 | 92 |
void SendConfig(); |
93 |
void SendQuickConfig(); |
|
341 | 94 |
void SendNetConfig(); |
588 | 95 |
void SendTrainingConfig(); |
184 | 96 |
void ParseMessage(const QByteArray & msg); |
533 | 97 |
void SetGameState(GameState state); |
184 | 98 |
}; |
99 |
||
100 |
#endif |