mirror of
https://github.com/devZoGok/PlanetFleet.git
synced 2026-08-26 19:43:29 +00:00
refactored Djikstra's algorithm's implementation to use map cells
This commit is contained in:
@@ -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(){
|
||||
|
||||
Reference in New Issue
Block a user