QTfrontend/net/hwmap.h
author sheepluva
Sun, 09 Sep 2012 20:11:07 +0200
changeset 7683 993337e5021f
parent 6952 7f70f37bbf08
child 8069 bb7671829935
permissions -rw-r--r--
client-flags: make code easier to read/prettier; add parsing of flag 'a'; add warning in console on unknown flag; ignore ADMIN_ACCESS
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>
6952
7f70f37bbf08 license header year range adjustments
sheepluva
parents: 6700
diff changeset
     4
 * Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com>
164
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
     5
 *
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 180
diff changeset
     6
 * This program is free software; you can redistribute it and/or modify
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 180
diff changeset
     7
 * it under the terms of the GNU General Public License as published by
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 180
diff changeset
     8
 * the Free Software Foundation; version 2 of the License
164
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
     9
 *
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 180
diff changeset
    10
 * This program is distributed in the hope that it will be useful,
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 180
diff changeset
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 180
diff changeset
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 180
diff changeset
    13
 * GNU General Public License for more details.
164
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    14
 *
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 180
diff changeset
    15
 * You should have received a copy of the GNU General Public License
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 180
diff changeset
    16
 * along with this program; if not, write to the Free Software
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 180
diff changeset
    17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
164
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    18
 */
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    19
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    20
#ifndef _HWMAP_INCLUDED
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    21
#define _HWMAP_INCLUDED
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    22
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    23
#include <QByteArray>
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    24
#include <QString>
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    25
#include <QImage>
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    26
177
c67c15e6fae3 prepare uniting tcp classes
displacer
parents: 170
diff changeset
    27
#include "tcpBase.h"
164
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    28
3133
1ab5f18f4df8 prg's maze generator
nemo
parents: 2377
diff changeset
    29
enum MapGenerator
1ab5f18f4df8 prg's maze generator
nemo
parents: 2377
diff changeset
    30
{
1ab5f18f4df8 prg's maze generator
nemo
parents: 2377
diff changeset
    31
    MAPGEN_REGULAR,
1ab5f18f4df8 prg's maze generator
nemo
parents: 2377
diff changeset
    32
    MAPGEN_MAZE,
4487
dbf69c7c5e00 Add drawn map into the list of map generators
unc0rr
parents: 4419
diff changeset
    33
    MAPGEN_DRAWN,
4562
b55f78fd2bf6 - Simplify map container code a bit
unc0rr
parents: 4534
diff changeset
    34
    MAPGEN_MAP
3133
1ab5f18f4df8 prg's maze generator
nemo
parents: 2377
diff changeset
    35
};
1ab5f18f4df8 prg's maze generator
nemo
parents: 2377
diff changeset
    36
177
c67c15e6fae3 prepare uniting tcp classes
displacer
parents: 170
diff changeset
    37
class HWMap : public TCPBase
164
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    38
{
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    39
        Q_OBJECT
2377
f3fab2b09e0c And in frontend
nemo
parents: 1797
diff changeset
    40
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    41
    public:
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    42
        HWMap();
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    43
        virtual ~HWMap();
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    44
        void getImage(const QString & seed, int templateFilter, MapGenerator mapgen, int maze_size, const QByteArray & drawMapData);
164
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    45
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    46
    protected:
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    47
        virtual QStringList getArguments();
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    48
        virtual void onClientDisconnect();
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    49
        virtual void SendToClientFirst();
177
c67c15e6fae3 prepare uniting tcp classes
displacer
parents: 170
diff changeset
    50
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    51
    signals:
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    52
        void ImageReceived(const QImage newImage);
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    53
        void HHLimitReceived(int hhLimit);
164
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    54
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    55
    private:
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    56
        QString m_seed;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    57
        int templateFilter;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    58
        MapGenerator m_mapgen;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    59
        int m_maze_size;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    60
        QByteArray m_drawMapData;
164
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    61
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    62
    private slots:
164
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    63
};
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    64
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    65
#endif // _HWMAP_INCLUDED