#ifndef MAP_H #define MAP_H #include #include #include #include #include #include #include "base_types.h" #include "settreader.h" // Maximum map is 65530 x 65530 because qHash may be repeat and towers has same Id class Map : public QObject { Q_OBJECT public: 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 > Cells; QList starts; QList finishs; int maxPlayers; explicit Map(int Id, QObject *parent = 0); int Id() const {return mapId;} bool addTowerOnMap(int playerId, QPoint pos); void delTowerOnMap(QPoint pos); void removeAliensPath(); QVector CreatePath(QPoint start, QPoint finish); QSize size() const {return mapsize;} void load(); signals: void RecreateAlienPath(bool * pathOK); public slots: void printMap(); private: int mapId; QSize mapsize; QVector < QVector > TmpCells; QVector InvWaveTrace(QPoint finish, int cnt); int WaveTrace(QPoint start, QPoint finish); void CreateMapExample(); void ReadSettings(); }; #endif // MAP_H