-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerator.h
68 lines (57 loc) · 2.03 KB
/
generator.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
63
64
65
66
67
68
#ifndef GENERATOR_HPP
#define GENERATOR_HPP
#include <vector>
#include <map>
#include <string>
enum directions {
UP = 0,
DOWN = ~UP,
RIGHT = 2,
LEFT = ~RIGHT
};
struct ELEMENT {
int x;
int y;
int z;
int t;
int direction;
};
typedef std::vector<ELEMENT> elementVector;
struct NEIGHBOR {
bool isOk;
int selection;
elementVector elements;
};
struct NEIGHBORS {
NEIGHBOR horizontal;
NEIGHBOR vertical;
};
struct POINT {
int x;
int y;
};
struct ROOM {
POINT point;
int height;
int width;
};
typedef std::map<std::string, std::vector<std::string>> wallRecordsMap;
typedef std::map<std::string, std::map<int, bool>> spacesMap;
typedef std::vector<ROOM> roomVector;
int random(int max);
bool labyrintProgress(wallRecordsMap wallRecords, int row, int col, int total);
bool recordCheck(int x, int y, int z, int t, wallRecordsMap wallRecords);
bool checkIfPointIsRemained(int x, int y, std::map<std::string, bool> remainedPointsMap);
NEIGHBORS getNeighbors(int x, int y, int row, int col, wallRecordsMap wallRecords, std::map<std::string, bool> remainedPointsMap);
bool isNeighborAvailable(int x, int y, NEIGHBOR neighbor, std::map<std::string, std::vector<std::string>> wallRecords);
void addRecord(int x, int y, int z, int t, std::map<std::string, std::vector<std::string>> *wallRecords);
void createRoads(int x, int y, int row, int col, std::map<std::string, std::vector<std::string>> *wallRecords, elementVector *map, std::map<std::string, bool> remainedPointsMap);
bool isItInsideOfRooms(int x, int y, roomVector rooms);
bool checkIfRechanglesHaveIntersection(int x, int y, int height, int width, roomVector rooms);
roomVector getRooms(int row, int col);
std::vector<POINT> getRemainedPoints(int row, int col, roomVector rooms);
std::map<std::string, bool> prepareRemainedPointsMap(std::vector<POINT> remainedPoints);
void prepareMazeSpaces(elementVector elements, spacesMap *spaces);
void prepareRoomSpaces(roomVector rooms, spacesMap *spaces);
spacesMap generateMap(int row, int col);
#endif