author | unc0rr |
Wed, 21 Feb 2007 19:40:06 +0000 | |
changeset 471 | e1eb64ba5e9c |
parent 443 | eec37eb7f5db |
child 486 | 7ea71cd3acd5 |
permissions | -rw-r--r-- |
172 | 1 |
/* |
2 |
* Hedgewars, a worms-like game |
|
3 |
* Copyright (c) 2006 Igor Ulyanov <iulyanov@gmail.com> |
|
4 |
* |
|
184 | 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 |
|
172 | 8 |
* |
184 | 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. |
|
172 | 13 |
* |
184 | 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 */ |
|
172 | 17 |
|
164 | 18 |
#include "hwmap.h" |
19 |
||
180
ea83b9e9057f
tcp sockets are incapsulated in TCPBase class now
displacer
parents:
177
diff
changeset
|
20 |
HWMap::HWMap() : |
ea83b9e9057f
tcp sockets are incapsulated in TCPBase class now
displacer
parents:
177
diff
changeset
|
21 |
TCPBase(false) |
164 | 22 |
{ |
23 |
} |
|
24 |
||
168 | 25 |
HWMap::~HWMap() |
26 |
{ |
|
27 |
} |
|
28 |
||
164 | 29 |
void HWMap::getImage(std::string seed) |
30 |
{ |
|
31 |
m_seed=seed; |
|
32 |
Start(); |
|
33 |
} |
|
34 |
||
177 | 35 |
QStringList HWMap::setArguments() |
36 |
{ |
|
37 |
QStringList arguments; |
|
291 | 38 |
arguments << QString("%1").arg(ipc_port); |
177 | 39 |
arguments << "landpreview"; |
40 |
return arguments; |
|
41 |
} |
|
42 |
||
43 |
void HWMap::onClientDisconnect() |
|
164 | 44 |
{ |
443
eec37eb7f5db
fort, grave and difficulty information for net team
displacer
parents:
291
diff
changeset
|
45 |
QImage im((uchar*)(readbuffer.constData()), 256, 128, QImage::Format_Mono); |
164 | 46 |
im.setNumColors(2); |
47 |
emit ImageReceived(im); |
|
48 |
} |
|
49 |
||
50 |
void HWMap::SendToClientFirst() |
|
51 |
{ |
|
52 |
std::string toSend=std::string("eseed ")+m_seed; |
|
180
ea83b9e9057f
tcp sockets are incapsulated in TCPBase class now
displacer
parents:
177
diff
changeset
|
53 |
SendIPC(toSend.c_str()); |
ea83b9e9057f
tcp sockets are incapsulated in TCPBase class now
displacer
parents:
177
diff
changeset
|
54 |
SendIPC("!"); |
164 | 55 |
} |