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