-
Notifications
You must be signed in to change notification settings - Fork 0
/
MazeStructure.h
72 lines (55 loc) · 1.98 KB
/
MazeStructure.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
69
70
71
72
#ifndef MAZESTRUCTURE_H
#define MAZESTRUCTURE_H
#include "MazeSpace.h"
#include <vector>
#include <map>
#include <iostream>
/* Structure class - defines a structure of Spaces, which is intended
to be pasted into a Floor.
Certain spaces in rooms, defined by the user, can have probabilities of
appearing as various kinds of spaces. These are resolved when a room gets
put into a Floor. */
namespace Maze {
// Enum for rotation. Rotation can be none,
// Class for generation probabilities resulting in different Spaces.
class Structure {
private:
/* The base type to represent different possibilities in a space is a Map
of unsigned shorts (the probabilities) to these pairs.
Then, these are all placed in a double vector. */
std::vector<std::vector<std::map<ushort, Space> > > spaces;
// Randomly resolve a certain space from the array of probabilities.
Space resolve_space(ushort x, ushort y);
// Structure name
std::string name;
public:
ushort width() const;
ushort height() const;
friend std::istream& operator>>(std::istream& instr, Structure& structure);
// Return the grid as a double vector of Spaces, resolving any possible
// choices of spaces and applying any transformations, ready to be copied
// into a MazeFloor.
std::vector<std::vector<Space> > generate
(ushort rotation, bool flipx, bool flipy);
};
// Input data into the class (a constructor isn't very appropriate)
std::istream& operator>>(std::istream& instr, Structure& structure);
}
/* MOVE THIS SOMEWHERE ELSE
// Class for information about placing of structures
class StructurePlacementInfo {
private:
ushort floor;
ushort spawnx;
ushort spawny;
ushort rotation;
bool flipx;
bool flipy;
public:
StructurePlacementInfo(ushort fl, ushort x, ushort y, ushort rot, bool flpx,
bool flpy):
floor(fl), spawnx(x), spawny(y), rotation(rot), flipx(flpx), flipy(flpy)
{}
};
*/
#endif