-
Notifications
You must be signed in to change notification settings - Fork 0
/
Map.h
62 lines (44 loc) · 1.02 KB
/
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef AGENTPROJECT_MAP_H
#define AGENTPROJECT_MAP_H
#define DUST_SPAWN_RATE 3
#define JEWEL_SPAWN_RATE 2
#define INITIAL_DUST_SPAWN_RATE 25
#define INITIAL_JEWEL_SPAWN_RATE 10
#define MAP_SIZE 5
#include <iostream>
#include <vector>
#include <mutex>
class Cell {
friend class Map;
private:
bool m_vacuum = false;
bool m_dust = false;
bool m_jewel = false;
public:
Cell(double dustRate = 0.0, double jewelRate = 0.0); // constructor
~Cell();
bool hasDust() const;
bool hasJewel() const;
bool hasVacuum() const;
void setDust(bool);
void setJewel(bool);
void setVacuum(bool);
friend std::ostream& operator<<(std::ostream&, const Cell& );
void spawnUpdate();
};
class Map {
public:
Map();
~Map();
int getMapSize();
Cell* getCell(int, int);
void mapUpdator();
void objSpawn(int); // thread func
void clean();
void pickup();
std::pair<int, int> getVacuum();
friend std::ostream& operator<<(std::ostream&, const Map& );
private:
std::vector< std::vector<Cell*> > map;
};
#endif //AGENTPROJECT_MAP_H