Fixed bug in path finding when no path found.

This commit is contained in:
Felix Ableitner 2013-04-27 19:16:46 +02:00
parent acafb57fec
commit 84264a6934

View file

@ -148,6 +148,8 @@ World::getPath(const sf::Vector2f& start, const sf::Vector2f& end,
if (!getArea(end)) if (!getArea(end))
return std::vector<sf::Vector2f>(); return std::vector<sf::Vector2f>();
std::vector<Portal*> portals = astarArea(getArea(start), getArea(end)); std::vector<Portal*> portals = astarArea(getArea(start), getArea(end));
if (portals.empty())
return std::vector<sf::Vector2f>();
std::vector<sf::Vector2f> path; std::vector<sf::Vector2f> path;
path.push_back(end); path.push_back(end);