Core is realy wait for work and test
Aliens create, wavetrace work, towers build, aliens move - thats all by now. I think it is time to write Graphic and Network modules.
This commit is contained in:
48
map.h
48
map.h
@@ -5,26 +5,62 @@
|
||||
#include <QSize>
|
||||
#include <QVector>
|
||||
#include <QPointF>
|
||||
#include <QRect>
|
||||
#include <QFile>
|
||||
|
||||
#include "base_types.h"
|
||||
|
||||
#include "settreader.h"
|
||||
|
||||
class Map : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Map(int Id, QSize size, QObject *parent = 0);
|
||||
|
||||
enum CellType
|
||||
{
|
||||
Player = 1,
|
||||
PlayerAlien = 1001,
|
||||
PlayerTower = -1,
|
||||
Wall = -1000,
|
||||
Start = 9999,
|
||||
Finish = 8888
|
||||
};
|
||||
// 1 - free for player 1
|
||||
// 2 - free for player 2
|
||||
// 3 - -/-
|
||||
// 1001 - player 1, free, but it is alien path (for optimization)
|
||||
// 1002 - -/-
|
||||
// 99999 - start field or finish field
|
||||
// -1 - player 1 tower
|
||||
// -2 - player 2 tower
|
||||
// -3 - -/-
|
||||
// -1000 - it is wall or some place where you can't build
|
||||
|
||||
QVector < QVector <int> > Cells;
|
||||
QVector < QVector <int> > TmpCells;
|
||||
QVector <QPoint> starts;
|
||||
QVector <QPoint> finishs;
|
||||
QSize mapsize;
|
||||
int maxPlayers;
|
||||
|
||||
explicit Map(int Id, QObject *parent = 0);
|
||||
int Id() const {return mapId;}
|
||||
int addTowerOnMap();
|
||||
int delTowerOnMap();
|
||||
bool addTowerOnMap(int playerId, QPoint pos);
|
||||
void delTowerOnMap(QPoint pos);
|
||||
QVector <QPointF> CreatePath(QPoint start, QPoint finish);
|
||||
QSize size() const {return mapsize;}
|
||||
void ReadSettings();
|
||||
signals:
|
||||
void RecreateAlienPath();
|
||||
void RecreateAlienPath(bool * pathOK);
|
||||
public slots:
|
||||
void printMap();
|
||||
|
||||
private:
|
||||
int **Cells;
|
||||
int mapId;
|
||||
|
||||
QVector<QPoint> InvWaveTrace(QPoint finish, int cnt);
|
||||
int WaveTrace(QPoint start, QPoint finish);
|
||||
void CreateMapExample();
|
||||
};
|
||||
|
||||
#endif // MAP_H
|
||||
|
||||
Reference in New Issue
Block a user