mirror of
https://github.com/liyunfan1223/mod-playerbots.git
synced 2026-02-20 18:10:02 +01:00
Travel: Fixed crash when trying to travel in maps with no nodes (#1171)
This commit is contained in:
parent
6d24db6999
commit
fc9555b7d4
@ -1348,6 +1348,9 @@ TravelNodeRoute TravelNodeMap::getRoute(WorldPosition startPos, WorldPosition en
|
||||
std::vector<WorldPosition> newStartPath;
|
||||
std::vector<TravelNode*> startNodes = m_nodes, endNodes = m_nodes;
|
||||
|
||||
if(!startNodes.size() || !endNodes.size())
|
||||
return TravelNodeRoute();
|
||||
|
||||
// Partial sort to get the closest 5 nodes at the begin of the array.
|
||||
std::partial_sort(startNodes.begin(), startNodes.begin() + 5, startNodes.end(),
|
||||
[startPos](TravelNode* i, TravelNode* j) { return i->fDist(startPos) < j->fDist(startPos); });
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user