Brought over a bunch of code from the roguelike and now will use it to generate a random map.
This commit is contained in:
parent
8d3d3b4ec3
commit
2daa1c9bd5
59 changed files with 4303 additions and 411 deletions
30
pathing.hpp
Normal file
30
pathing.hpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
#pragma once
|
||||
#include "point.hpp"
|
||||
#include "matrix.hpp"
|
||||
#include <functional>
|
||||
|
||||
using matrix::Matrix;
|
||||
|
||||
class Pathing {
|
||||
public:
|
||||
size_t $width;
|
||||
size_t $height;
|
||||
Matrix $paths;
|
||||
Matrix $input;
|
||||
|
||||
Pathing(size_t width, size_t height) :
|
||||
$width(width),
|
||||
$height(height),
|
||||
$paths(height, matrix::Row(width, 1)),
|
||||
$input(height, matrix::Row(width, 1))
|
||||
{}
|
||||
|
||||
void compute_paths(Matrix &walls);
|
||||
void set_target(const Point &at, int value=0);
|
||||
void clear_target(const Point &at);
|
||||
Matrix &paths() { return $paths; }
|
||||
Matrix &input() { return $input; }
|
||||
int distance(Point to) { return $paths[to.y][to.x];}
|
||||
|
||||
bool INVARIANT();
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue