Refactored the maze functions to be a builder that can do different things to the maze. Also when I hit p in the game it'll save the map to a file. This was extremely hard for no reason.
This commit is contained in:
parent
20f03731e5
commit
5f1a453fb4
8 changed files with 270 additions and 254 deletions
26
maze.hpp
26
maze.hpp
|
@ -4,16 +4,26 @@
|
|||
|
||||
namespace maze {
|
||||
|
||||
void init(Matrix& maze);
|
||||
|
||||
void hunt_and_kill(Matrix& maze, std::vector<Room>& rooms, std::vector<Point>& dead_ends);
|
||||
struct Builder {
|
||||
Matrix& $walls;
|
||||
std::vector<Room>& $rooms;
|
||||
std::vector<Point>& $dead_ends;
|
||||
|
||||
void randomize_rooms(std::vector<Room>& rooms_out, std::vector<Point>& maybe_here);
|
||||
Builder(Map& map) :
|
||||
$walls(map.$walls), $rooms(map.$rooms), $dead_ends(map.$dead_ends)
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
void inner_donut(Matrix& maze, float outer_rad, float inner_rad);
|
||||
void inner_box(Matrix& map, size_t outer_size, size_t inner_size);
|
||||
void hunt_and_kill();
|
||||
|
||||
void divide(Matrix& maze, Point start, Point end);
|
||||
|
||||
void remove_dead_ends(Matrix& maze, std::vector<Point>& dead_ends);
|
||||
void init();
|
||||
void randomize_rooms();
|
||||
void inner_donut(float outer_rad, float inner_rad);
|
||||
void inner_box(size_t outer_size, size_t inner_size);
|
||||
void divide(Point start, Point end);
|
||||
void remove_dead_ends();
|
||||
void dump(const std::string& msg);
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue