mirror of
https://github.com/devZoGok/PlanetFleet.git
synced 2026-08-26 19:43:29 +00:00
calculating heuristics in a function
ending pathpoint generation early for empty paths
This commit is contained in:
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user