author | unc0rr |
Sat, 20 Sep 2008 03:54:56 +0000 | |
changeset 1282 | 76533d0e76e3 |
parent 1066 | 1f1b3686a2b0 |
child 1374 | f33fa81e583d |
permissions | -rw-r--r-- |
315 | 1 |
/* |
1066 | 2 |
* Hedgewars, a free turn based strategy game |
883 | 3 |
* Copyright (c) 2006, 2008 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: |
|
672
08ed55ea1e2a
- Fix a bug when server fails to start, and then connecting to another server on the same host (strange, the fix won't work on my machine)
unc0rr
parents:
658
diff
changeset
|
38 |
bool StartServer(quint16 port); |
315 | 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; |
658 | 59 |
quint16 ds_port; |
315 | 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 |