28 class GameUIConfig; |
28 class GameUIConfig; |
29 class GameCFGWidget; |
29 class GameCFGWidget; |
30 class TeamSelWidget; |
30 class TeamSelWidget; |
31 |
31 |
32 enum GameState { |
32 enum GameState { |
33 gsNotStarted = 0, |
33 gsNotStarted = 0, |
34 gsStarted = 1, |
34 gsStarted = 1, |
35 gsInterrupted = 2, |
35 gsInterrupted = 2, |
36 gsFinished = 3, |
36 gsFinished = 3, |
37 gsStopped = 4, |
37 gsStopped = 4, |
38 gsDestroyed = 5 |
38 gsDestroyed = 5 |
39 }; |
39 }; |
40 |
40 |
41 |
41 |
42 class HWGame : public TCPBase |
42 class HWGame : public TCPBase |
43 { |
43 { |
44 Q_OBJECT |
44 Q_OBJECT |
45 public: |
45 public: |
46 HWGame(GameUIConfig * config, GameCFGWidget * gamecfg, QString ammo, TeamSelWidget* pTeamSelWidget = 0); |
46 HWGame(GameUIConfig * config, GameCFGWidget * gamecfg, QString ammo, TeamSelWidget* pTeamSelWidget = 0); |
47 virtual ~HWGame(); |
47 virtual ~HWGame(); |
48 void AddTeam(const QString & team); |
48 void AddTeam(const QString & team); |
49 void PlayDemo(const QString & demofilename); |
49 void PlayDemo(const QString & demofilename); |
50 void StartLocal(); |
50 void StartLocal(); |
51 void StartQuick(); |
51 void StartQuick(); |
52 void StartNet(); |
52 void StartNet(); |
53 void StartTraining(const QString & file); |
53 void StartTraining(const QString & file); |
54 |
54 |
55 protected: |
55 protected: |
56 virtual QStringList setArguments(); |
56 virtual QStringList setArguments(); |
57 virtual void onClientRead(); |
57 virtual void onClientRead(); |
58 virtual void onClientDisconnect(); |
58 virtual void onClientDisconnect(); |
59 |
59 |
60 signals: |
60 signals: |
61 void SendNet(const QByteArray & msg); |
61 void SendNet(const QByteArray & msg); |
62 void SendChat(const QString & msg); |
62 void SendChat(const QString & msg); |
63 void SendTeamMessage(const QString & msg); |
63 void SendTeamMessage(const QString & msg); |
64 void GameStateChanged(GameState gameState); |
64 void GameStateChanged(GameState gameState); |
65 void GameStats(char type, const QString & info); |
65 void GameStats(char type, const QString & info); |
66 void HaveRecord(bool isDemo, const QByteArray & record); |
66 void HaveRecord(bool isDemo, const QByteArray & record); |
67 void ErrorMessage(const QString &); |
67 void ErrorMessage(const QString &); |
68 |
68 |
69 public slots: |
69 public slots: |
70 void FromNet(const QByteArray & msg); |
70 void FromNet(const QByteArray & msg); |
71 void FromNetChat(const QString & msg); |
71 void FromNetChat(const QString & msg); |
72 |
72 |
73 private: |
73 private: |
74 enum GameType { |
74 enum GameType { |
75 gtLocal = 1, |
75 gtLocal = 1, |
76 gtQLocal = 2, |
76 gtQLocal = 2, |
77 gtDemo = 3, |
77 gtDemo = 3, |
78 gtNet = 4, |
78 gtNet = 4, |
79 gtTraining = 5 |
79 gtTraining = 5 |
80 }; |
80 }; |
81 char msgbuf[MAXMSGCHARS]; |
81 char msgbuf[MAXMSGCHARS]; |
82 QString teams[5]; |
82 QString teams[5]; |
83 QString ammostr; |
83 QString ammostr; |
84 int TeamCount; |
84 int TeamCount; |
85 GameUIConfig * config; |
85 GameUIConfig * config; |
86 GameCFGWidget * gamecfg; |
86 GameCFGWidget * gamecfg; |
87 TeamSelWidget* m_pTeamSelWidget; |
87 TeamSelWidget* m_pTeamSelWidget; |
88 GameType gameType; |
88 GameType gameType; |
89 GameState gameState; |
89 GameState gameState; |
90 |
90 |
91 void commonConfig(); |
91 void commonConfig(); |
92 void SendConfig(); |
92 void SendConfig(); |
93 void SendQuickConfig(); |
93 void SendQuickConfig(); |
94 void SendNetConfig(); |
94 void SendNetConfig(); |
95 void SendTrainingConfig(); |
95 void SendTrainingConfig(); |
96 void ParseMessage(const QByteArray & msg); |
96 void ParseMessage(const QByteArray & msg); |
97 void SetGameState(GameState state); |
97 void SetGameState(GameState state); |
98 }; |
98 }; |
99 |
99 |
100 #endif |
100 #endif |