1 /* |
|
2 * Hedgewars, a free turn based strategy game |
|
3 * Copyright (c) 2006 Igor Ulyanov <iulyanov@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 _HET_CONNECTEDCLIENT_INCLUDED |
|
20 #define _HET_CONNECTEDCLIENT_INCLUDED |
|
21 |
|
22 #include <QObject> |
|
23 #include <QList> |
|
24 #include <QMap> |
|
25 #include <QStringList> |
|
26 |
|
27 class HWNetServer; |
|
28 class QTcpSocket; |
|
29 class QTcpServer; |
|
30 |
|
31 class HWConnectedClient : public QObject |
|
32 { |
|
33 Q_OBJECT |
|
34 |
|
35 friend class HWNetServer; |
|
36 |
|
37 private: |
|
38 HWConnectedClient(HWNetServer* hwserver, QTcpSocket* client); |
|
39 ~HWConnectedClient(); |
|
40 QString getClientNick() const; |
|
41 |
|
42 QList<QStringList> getTeamNames() const; |
|
43 class NoTeamNameException{}; |
|
44 bool isReady() const; |
|
45 |
|
46 QString getHedgehogsDescription() const; |
|
47 |
|
48 bool readyToStart; |
|
49 QList<QStringList> m_teamsCfg; // TeamName - hhs |
|
50 class ShouldDisconnectException {}; |
|
51 |
|
52 QString client_nick; |
|
53 void ParseCmd(const QStringList & lst); |
|
54 unsigned int removeTeam(const QString& tname); // returns netID |
|
55 |
|
56 HWNetServer* m_hwserver; |
|
57 QTcpSocket* m_client; |
|
58 |
|
59 void RawSendNet(const QString & buf); |
|
60 void RawSendNet(const QByteArray & buf); |
|
61 |
|
62 QStringList cmdbuf; |
|
63 |
|
64 unsigned int netIDbyTeamName(const QString& tname); |
|
65 |
|
66 signals: |
|
67 void HWClientDisconnected(HWConnectedClient* client); |
|
68 |
|
69 private slots: |
|
70 void ClientRead(); |
|
71 void ClientDisconnect(); |
|
72 }; |
|
73 |
|
74 #endif // _HET_CONNECTEDCLIENT_INCLUDED |
|