author | unc0rr |
Sun, 11 Feb 2007 12:27:45 +0000 | |
changeset 432 | b0f693024b50 |
parent 420 | 6cdfc07dceed |
child 465 | 07eca0a2546c |
permissions | -rw-r--r-- |
315 | 1 |
/* |
2 |
* Hedgewars, a worms-like 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 _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); |
|
315 | 44 |
bool haveNick(const QString& nick) const; |
45 |
QString getRunningHostName() const; |
|
46 |
quint16 getRunningPort() const; |
|
338
d1e75dcd285f
multiple teams now available per host (still alpha)
displacer
parents:
335
diff
changeset
|
47 |
QList<QStringList> getTeamsConfig() const; |
315 | 48 |
void teamChanged(); |
49 |
bool shouldStart(HWConnectedClient* client); |
|
50 |
QString prepareConfig(QStringList lst); |
|
388 | 51 |
void resetStart(); |
315 | 52 |
|
404 | 53 |
QMap<QString, QStringList> m_gameCfg; // config_param - value |
399 | 54 |
int hhnum; |
55 |
||
315 | 56 |
private: |
334 | 57 |
HWConnectedClient* getChiefClient() const; |
315 | 58 |
static const quint16 ds_port; |
59 |
QTcpServer* IPCServer; |
|
60 |
QList<HWConnectedClient*> connclients; |
|
61 |
||
62 |
private slots: |
|
63 |
void NewConnection(); |
|
64 |
void ClientDisconnect(HWConnectedClient* client); |
|
65 |
}; |
|
66 |
||
67 |
#endif // _NETSERVER_INCLUDED |