-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmap.h
37 lines (28 loc) · 867 Bytes
/
map.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef MAP_H
#define MAP_H
#include <QGraphicsScene>
#include <QGraphicsLineItem>
#include <QVector>
#include "gridelement.h"
#include "building.h"
#include "chest.h"
class Map
{
public:
explicit Map(QGraphicsScene * scene = nullptr);
~Map();
GridElement * getGridElement(int x, int y) { return vector[x][y]; }
QVector<QPoint> neighbours(GridElement * center);
bool checkIfPointIsTaken(QPoint center) { return vector[center.x()][center.y()]->isTaken() == true ? true : false; }
void togglePoint(QPoint p) { vector[p.x()][p.y()]->toggleTaken(); }
void addChest(QPointF p);
private:
QGraphicsScene * scene;
QGraphicsLineItem * line1;
QGraphicsLineItem * line2;
QGraphicsLineItem * line3;
QGraphicsLineItem * line4;
QVector<QVector<GridElement *>> vector;
void addBuilding(QPointF p);
};
#endif // MAP_H