Fixed stupid mistake in for loop

This commit is contained in:
Trygve 2024-05-03 20:54:45 +02:00
parent 9d8df3256d
commit 4cd4f773bf

View File

@ -63,23 +63,30 @@ std::vector<std::vector<Point>> vector_cellmap(HeightMap* heightmap, int interva
if (candidate->x +1 == current->x && candidate->y == current->y) { if (candidate->x +1 == current->x && candidate->y == current->y) {
current->next = candidate; current->next = candidate;
candidate->previous = current; candidate->previous = current;
break;
} }
else if (candidate->x -1 == current->x && candidate->y == current->y) { else if (candidate->x -1 == current->x && candidate->y == current->y) {
current->next = candidate; current->next = candidate;
candidate->previous = current; candidate->previous = current;
break;
} }
else if (candidate->y +1 == current->y && candidate->x == current->x) { else if (candidate->y +1 == current->y && candidate->x == current->x) {
current->next = candidate; current->next = candidate;
candidate->previous = current; candidate->previous = current;
break;
} }
else if (candidate->y -1 == current->y && candidate->x == current->x) { else if (candidate->y -1 == current->y && candidate->x == current->x) {
current->next = candidate; current->next = candidate;
candidate->previous = current; candidate->previous = current;
break;
} }
else { }
}
if (current->next == nullptr)
{
current->endpoint = true; current->endpoint = true;
} std::cout << "🤕";
}
} }
} }
@ -177,7 +184,7 @@ void write_output_file(std::vector<std::vector<Point>> all_points, const char *f
std::vector<Point> points = all_points[j]; std::vector<Point> points = all_points[j];
Point* current = &points[0]; Point* current = &points[50];
while (true) while (true)
{ {
//int x_raw = i%width; //int x_raw = i%width;