Removed the variable limit setting since it's never used and instead just have WALL_PATH_LIMIT.

This commit is contained in:
Zed A. Shaw 2024-12-05 08:41:10 -05:00
parent 9abb39a3bf
commit eb0ca38e30
19 changed files with 50 additions and 58 deletions

View file

@ -1,3 +1,4 @@
#include "constants.hpp"
#include "pathing.hpp"
#include "dbc.hpp"
#include <vector>
@ -30,9 +31,7 @@ inline void add_neighbors(PointList &neighbors, Matrix &closed, size_t y, size_t
void Pathing::compute_paths(Matrix &walls) {
INVARIANT();
// Initialize the new array with every pixel at limit distance
// NOTE: this is normally ones() * limit
int limit = $limit == 0 ? $height * $width : $limit;
matrix_assign($paths, limit);
matrix_assign($paths, WALL_PATH_LIMIT);
Matrix closed = walls;
PointList starting_pixels;
@ -56,7 +55,7 @@ void Pathing::compute_paths(Matrix &walls) {
// Third pass: Iterate filling in the open list
int counter = 1; // leave this here so it's available below
for(; counter < limit && !open_pixels.empty(); ++counter) {
for(; counter < WALL_PATH_LIMIT && !open_pixels.empty(); ++counter) {
PointList next_open;
for(auto sp : open_pixels) {
$paths[sp.y][sp.x] = counter;