Hi,
I am trying make an A* algorithm. My algorithm works good without walls but when i add walls it doesnt work i don't know why full code :
A-StarTest01.zip

And this is the main finding function:
Qt Code:
  1. void PathFinder::findPath()
  2. {
  3. pathFind = false;
  4. openList.clear();
  5. closedList.clear();
  6. QQuickItem *currentItem = start;
  7. QList<QQuickItem*> path;
  8. closedList.append(start);
  9. findNeighbors(currentItem);
  10. while(!openList.isEmpty())
  11. {
  12. findNeighbors(currentItem);
  13. QQuickItem *minimal = openList.first();
  14. foreach (QQuickItem *item, openList)
  15. {
  16. int minF = getF(currentItem, minimal);
  17. int itemF = getF(currentItem, item);
  18. if(itemF < minF)
  19. {
  20. minimal = item;
  21.  
  22. }
  23. }
  24. currentItem = minimal;
  25. closedList.append(currentItem);
  26. path.append(currentItem);
  27.  
  28. if(currentItem == finish)
  29. {
  30. pathFind = true;
  31. path.removeOne(currentItem);
  32. drawPath(path);
  33. break;
  34. }
  35. }
  36.  
  37. qDebug() << (pathFind ? "path finded" : "no path");
  38.  
  39. }
To copy to clipboard, switch view to plain text mode 
Please help me i dont have any idea how make it