Fixed bug in path finding when no path found.
This commit is contained in:
parent
acafb57fec
commit
84264a6934
1 changed files with 2 additions and 0 deletions
|
@ -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);
|
||||||
|
|
Reference in a new issue