author | unc0rr |
Thu, 30 Nov 2006 22:36:07 +0000 | |
changeset 287 | b0eef98928f8 |
parent 184 | f97a7a3dc8f6 |
child 291 | afa378f1e961 |
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; |
|
38 |
arguments << "46631"; |
|
39 |
arguments << "landpreview"; |
|
40 |
return arguments; |
|
41 |
} |
|
42 |
||
43 |
void HWMap::onClientDisconnect() |
|
164 | 44 |
{ |
45 |
QImage im((uchar*)(const char*)readbuffer, 256, 128, QImage::Format_Mono); |
|
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 |
} |