-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmap.h
38 lines (34 loc) · 1015 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
38
#ifndef MAP_H
#define MAP_H
#include "structures.h"
#include "mapobj.h"
#include <fstream>
class MapCell {
public:
inline MapCell() {}
inline ~MapCell() {/*delete obj;*/}
MapObj* obj = NULL;
Vector pos;
};
class Map {
private:
MapCell** data;
Vector size;
std::fstream file;
void read(char** data);
void setSize(Vector size);
public:
Map(); // временно
Map(Vector m_size);
Map(char* name);
~Map();
char** build(Vector start, Vector end); // возвращает кусок карты для объекта класса Field
void load(char* name);
void save(char* name);
void destroy(); // уничтожает все объекты на карте
void addObj(MapObj* obj, Vector pos);
MapObj* findObj(Vector pos); // возвращает объект по координатам
bool existObj(Vector pos); // проверяет, существует ли объект на данных коордах
inline Vector getSize() {return size;}
};
#endif // MAP_H