author | unc0rr |
Sun, 30 Sep 2007 13:36:32 +0000 | |
changeset 615 | b646b3c43369 |
parent 486 | 7ea71cd3acd5 |
child 658 | a7e625f5d9d0 |
permissions | -rw-r--r-- |
315 | 1 |
/* |
2 |
* Hedgewars, a worms-like game |
|
486 | 3 |
* Copyright (c) 2006, 2007 Igor Ulyanov <iulyanov@gmail.com> |
315 | 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 _NETSERVER_INCLUDED |
|
20 |
#define _NETSERVER_INCLUDED |
|
21 |
||
22 |
#include <QObject> |
|
23 |
#include <QList> |
|
335 | 24 |
#include <QMap> |
315 | 25 |
|
26 |
#include "team.h" |
|
27 |
||
28 |
class HWNetServer; |
|
29 |
class QTcpSocket; |
|
30 |
class QTcpServer; |
|
420
6cdfc07dceed
netserver and netonnectedclient splited to different files
displacer
parents:
404
diff
changeset
|
31 |
class HWConnectedClient; |
315 | 32 |
|
33 |
class HWNetServer : public QObject |
|
34 |
{ |
|
35 |
Q_OBJECT |
|
36 |
||
37 |
public: |
|
38 |
void StartServer(); |
|
39 |
void StopServer(); |
|
326 | 40 |
bool isChiefClient(HWConnectedClient* cl) const; |
354
60e4af0a4375
network to local teams map, addteams from server before team config bug, fixed some segfaults
displacer
parents:
352
diff
changeset
|
41 |
QMap<QString, QStringList> getGameCfg() const; |
319 | 42 |
void sendAll(QString gameCfg); |
43 |
void sendOthers(HWConnectedClient* this_cl, QString gameCfg); |
|
465 | 44 |
void sendNicks(HWConnectedClient* cl) const; |
315 | 45 |
bool haveNick(const QString& nick) const; |
46 |
QString getRunningHostName() const; |
|
47 |
quint16 getRunningPort() const; |
|
338
d1e75dcd285f
multiple teams now available per host (still alpha)
displacer
parents:
335
diff
changeset
|
48 |
QList<QStringList> getTeamsConfig() const; |
315 | 49 |
void teamChanged(); |
50 |
bool shouldStart(HWConnectedClient* client); |
|
51 |
QString prepareConfig(QStringList lst); |
|
388 | 52 |
void resetStart(); |
315 | 53 |
|
404 | 54 |
QMap<QString, QStringList> m_gameCfg; // config_param - value |
399 | 55 |
int hhnum; |
56 |
||
315 | 57 |
private: |
334 | 58 |
HWConnectedClient* getChiefClient() const; |
315 | 59 |
static const quint16 ds_port; |
60 |
QTcpServer* IPCServer; |
|
61 |
QList<HWConnectedClient*> connclients; |
|
62 |
||
63 |
private slots: |
|
64 |
void NewConnection(); |
|
65 |
void ClientDisconnect(HWConnectedClient* client); |
|
66 |
}; |
|
67 |
||
68 |
#endif // _NETSERVER_INCLUDED |