refactored Djikstra's algorithm's implementation to use map cells

This commit is contained in:
devZoGok
2023-09-03 09:55:23 +03:00
parent 9ca9bf8e09
commit 4e5c539519
5 changed files with 39 additions and 39 deletions
+11
View File
@@ -20,6 +20,17 @@ using namespace gameBase;
namespace battleship{
using namespace configData;
//TODO check if edges have lower weight than impassible weight value for the Pathfinder
int Map::Cell::getEdgeWeight(int destCellId){
int weight = Pathfinder::getSingleton()->getImpassibleNodeVal();
for(Edge e : edges)
if(e.destCellId == destCellId)
weight = e.weight;
return weight;
}
Map *map = nullptr;
Map* Map::getSingleton(){