QTfrontend/hwmap.h
author unc0rr
Wed, 08 Dec 2010 22:18:50 +0300
changeset 4489 c4ca9ced258b
parent 4487 dbf69c7c5e00
child 4534 395278890955
permissions -rw-r--r--
- Pass map drawing data to engine - Hardcode one map for test purposes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
164
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
     1
/*
1066
1f1b3686a2b0 Update copyright headers a bit
unc0rr
parents: 184
diff changeset
     2
 * Hedgewars, a free turn based strategy game
164
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
     3
 * Copyright (c) 2006 Igor Ulyanov <iulyanov@gmail.com>
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
     4
 *
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 180
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 180
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 180
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
164
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
     8
 *
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 180
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 180
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 180
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 180
diff changeset
    12
 * GNU General Public License for more details.
164
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    13
 *
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 180
diff changeset
    14
 * You should have received a copy of the GNU General Public License
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 180
diff changeset
    15
 * along with this program; if not, write to the Free Software
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 180
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
164
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    17
 */
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    18
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    19
#ifndef _HWMAP_INCLUDED
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    20
#define _HWMAP_INCLUDED
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    21
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    22
#include <QByteArray>
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    23
#include <QString>
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    24
#include <QImage>
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    25
177
c67c15e6fae3 prepare uniting tcp classes
displacer
parents: 170
diff changeset
    26
#include "tcpBase.h"
164
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    27
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    28
#include <string>
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    29
3133
1ab5f18f4df8 prg's maze generator
nemo
parents: 2377
diff changeset
    30
enum MapGenerator
1ab5f18f4df8 prg's maze generator
nemo
parents: 2377
diff changeset
    31
{
1ab5f18f4df8 prg's maze generator
nemo
parents: 2377
diff changeset
    32
    MAPGEN_REGULAR,
1ab5f18f4df8 prg's maze generator
nemo
parents: 2377
diff changeset
    33
    MAPGEN_MAZE,
4487
dbf69c7c5e00 Add drawn map into the list of map generators
unc0rr
parents: 4419
diff changeset
    34
    MAPGEN_DRAWN,
4419
3d99c2c806ec fix for frontend desync
prg
parents: 3133
diff changeset
    35
    MAPGEN_LAST
3133
1ab5f18f4df8 prg's maze generator
nemo
parents: 2377
diff changeset
    36
};
1ab5f18f4df8 prg's maze generator
nemo
parents: 2377
diff changeset
    37
177
c67c15e6fae3 prepare uniting tcp classes
displacer
parents: 170
diff changeset
    38
class HWMap : public TCPBase
164
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    39
{
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    40
  Q_OBJECT
2377
f3fab2b09e0c And in frontend
nemo
parents: 1797
diff changeset
    41
164
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    42
 public:
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    43
  HWMap();
168
679e9b8912f5 multiple server starting improved
displacer
parents: 164
diff changeset
    44
  virtual ~HWMap();
4489
c4ca9ced258b - Pass map drawing data to engine
unc0rr
parents: 4487
diff changeset
    45
  void getImage(std::string seed, int templateFilter, MapGenerator mapgen, int maze_size, const QByteArray & drawMapData);
164
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    46
177
c67c15e6fae3 prepare uniting tcp classes
displacer
parents: 170
diff changeset
    47
 protected:
c67c15e6fae3 prepare uniting tcp classes
displacer
parents: 170
diff changeset
    48
  virtual QStringList setArguments();
c67c15e6fae3 prepare uniting tcp classes
displacer
parents: 170
diff changeset
    49
  virtual void onClientDisconnect();
c67c15e6fae3 prepare uniting tcp classes
displacer
parents: 170
diff changeset
    50
  virtual void SendToClientFirst();
c67c15e6fae3 prepare uniting tcp classes
displacer
parents: 170
diff changeset
    51
164
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    52
 signals:
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    53
  void ImageReceived(const QImage newImage);
1790
c84223511ca8 frontend's part of nemo patch
unc0rr
parents: 1066
diff changeset
    54
  void HHLimitReceived(int hhLimit);
164
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    55
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    56
 private:
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    57
  std::string m_seed;
1797
fedd8649fdd9 Templates filter by nemo
unc0rr
parents: 1790
diff changeset
    58
  int templateFilter;
3133
1ab5f18f4df8 prg's maze generator
nemo
parents: 2377
diff changeset
    59
  MapGenerator m_mapgen;
1ab5f18f4df8 prg's maze generator
nemo
parents: 2377
diff changeset
    60
  int m_maze_size;
4489
c4ca9ced258b - Pass map drawing data to engine
unc0rr
parents: 4487
diff changeset
    61
  QByteArray m_drawMapData;
164
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    62
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    63
 private slots:
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    64
};
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    65
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    66
#endif // _HWMAP_INCLUDED