#ifndef MAP_H #define MAP_H #include "base_types.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 { Free = 0, Player = 1, AlienPath = 1000, 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 explicit Map(QByteArray data, QSize size, QString name, int maxPlayers, int image, QObject *parent = 0); bool addTowerOnMap(int playerId, QPoint pos); //bool isFreePlace(QPoint pos); void delTowerOnMap(int playerId, QPoint pos); void removeAliensPath(); QVector createPath(QPoint start, QPoint finish); QRect rect() const {return QRect(QPoint(),mapSize);} // QString name() const {return mapName;} QList starts() const {return Starts;} QList finishs() const {return Finishs;} QVector < QVector > cells() const {return Cells;} int image() const {return imageType;} int maxPlayers() const {return players;} signals: void recreateAlienPath(bool * pathOK); public slots: void printMap(); private: QSize mapSize; QString mapName; int players; int imageType; QVector < QVector > Cells; QList Starts; QList Finishs; QVector < QVector > TmpCells; QVector invWaveTrace(QPoint finish, int cnt); int waveTrace(QPoint start, QPoint finish); bool isReachable(int playerId, QPoint pos); //void CreateMapExample(); //void ReadSettings(); }; #endif // MAP_H