1 /* |
1 /* |
2 * Hedgewars, a free turn based strategy game |
2 * Hedgewars, a free turn based strategy game |
3 * Copyright (c) 2006 Igor Ulyanov <iulyanov@gmail.com> |
3 * Copyright (c) 2006 Igor Ulyanov <iulyanov@gmail.com> |
4 * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com> |
4 * Copyright (c) 2004-2015 Andrey Korotaev <unC0Rr@gmail.com> |
5 * |
5 * |
6 * This program is free software; you can redistribute it and/or modify |
6 * This program is free software; you can redistribute it and/or modify |
7 * it under the terms of the GNU General Public License as published by |
7 * it under the terms of the GNU General Public License as published by |
8 * the Free Software Foundation; version 2 of the License |
8 * the Free Software Foundation; version 2 of the License |
9 * |
9 * |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 * GNU General Public License for more details. |
13 * GNU General Public License for more details. |
14 * |
14 * |
15 * You should have received a copy of the GNU General Public License |
15 * You should have received a copy of the GNU General Public License |
16 * along with this program; if not, write to the Free Software |
16 * along with this program; if not, write to the Free Software |
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
18 */ |
18 */ |
19 |
19 |
20 #ifndef _HWMAP_INCLUDED |
20 #ifndef _HWMAP_INCLUDED |
21 #define _HWMAP_INCLUDED |
21 #define _HWMAP_INCLUDED |
22 |
22 |
23 #include <QByteArray> |
23 #include <QByteArray> |
24 #include <QString> |
24 #include <QString> |
25 #include <QImage> |
25 #include <QPixmap> |
26 |
26 |
27 #include "tcpBase.h" |
27 #include "tcpBase.h" |
28 |
28 |
29 enum MapGenerator |
29 enum MapGenerator |
30 { |
30 { |
31 MAPGEN_REGULAR, |
31 MAPGEN_REGULAR = 0, |
32 MAPGEN_MAZE, |
32 MAPGEN_MAZE = 1, |
33 MAPGEN_DRAWN, |
33 MAPGEN_PERLIN = 2, |
34 MAPGEN_MAP |
34 MAPGEN_DRAWN = 3, |
|
35 MAPGEN_MAP = 4 |
35 }; |
36 }; |
36 |
37 |
37 class HWMap : public TCPBase |
38 class HWMap : public TCPBase |
38 { |
39 { |
39 Q_OBJECT |
40 Q_OBJECT |
40 |
41 |
41 public: |
42 public: |
42 HWMap(QObject *parent = 0); |
43 HWMap(QObject *parent = 0); |
43 virtual ~HWMap(); |
44 virtual ~HWMap(); |
44 void getImage(const QString & seed, int templateFilter, MapGenerator mapgen, int maze_size, const QByteArray & drawMapData); |
45 void getImage(const QString & seed, int templateFilter, MapGenerator mapgen, int maze_size, const QByteArray & drawMapData, QString & script, QString & scriptparam, int feature_size); |
45 bool couldBeRemoved(); |
46 bool couldBeRemoved(); |
46 |
47 |
47 protected: |
48 protected: |
48 virtual QStringList getArguments(); |
49 virtual QStringList getArguments(); |
49 virtual void onClientDisconnect(); |
50 virtual void onClientDisconnect(); |
50 virtual void SendToClientFirst(); |
51 virtual void SendToClientFirst(); |
51 |
52 |
52 signals: |
53 signals: |
53 void ImageReceived(const QImage newImage); |
54 void ImageReceived(const QPixmap & newImage); |
54 void HHLimitReceived(int hhLimit); |
55 void HHLimitReceived(int hhLimit); |
55 |
56 |
56 private: |
57 private: |
57 QString m_seed; |
58 QString m_seed; |
|
59 QString m_script; |
|
60 QString m_scriptparam; |
58 int templateFilter; |
61 int templateFilter; |
59 MapGenerator m_mapgen; |
62 MapGenerator m_mapgen; |
60 int m_maze_size; |
63 int m_maze_size; // going to try and deprecate this one |
|
64 int m_feature_size; |
61 QByteArray m_drawMapData; |
65 QByteArray m_drawMapData; |
62 |
66 |
63 private slots: |
67 private slots: |
64 }; |
68 }; |
65 |
69 |