calculating heuristics in a function

ending pathpoint generation early for empty paths
This commit is contained in:
devZoGok
2026-03-15 15:21:11 +02:00
parent 4709581fcd
commit 03f9f9cc2e
3 changed files with 14 additions and 4 deletions
+9
View File
@@ -16,6 +16,15 @@ namespace battleship{
return pathfinder;
}
vector<float> Pathfinder::calcHeuristics(vector<Map::Cell> &cells, int dest){
vector<float> heuristics;
for(Map::Cell &cell : cells)
heuristics.push_back(145 * (cells[dest].pos.getDistanceFrom(cell.pos)));
return heuristics;
}
vector<int> Pathfinder::findPath(vector<Map::Cell> &cells, vector<float> &heuristics, int source, int dest, Vehicle *vehicle){
const int size = cells.size();
u32 *distances = new u32[size];