mirror of
https://github.com/EQEmu/Server.git
synced 2026-08-30 13:47:57 +00:00
Use lambdas in sort functions (for zone at least)
This commit is contained in:
+6
-6
@@ -345,10 +345,10 @@ bool CheckLOSBetweenPoints(Map::Vertex start, Map::Vertex end) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SortPathNodesByDistance(PathNodeSortStruct n1, PathNodeSortStruct n2)
|
||||
auto path_compare = [](const PathNodeSortStruct& a, const PathNodeSortStruct& b)
|
||||
{
|
||||
return n1.Distance < n2.Distance;
|
||||
}
|
||||
return a.Distance < b.Distance;
|
||||
};
|
||||
|
||||
std::deque<int> PathManager::FindRoute(Map::Vertex Start, Map::Vertex End)
|
||||
{
|
||||
@@ -382,7 +382,7 @@ std::deque<int> PathManager::FindRoute(Map::Vertex Start, Map::Vertex End)
|
||||
}
|
||||
}
|
||||
|
||||
std::sort(SortedByDistance.begin(), SortedByDistance.end(), SortPathNodesByDistance);
|
||||
std::sort(SortedByDistance.begin(), SortedByDistance.end(), path_compare);
|
||||
|
||||
for(auto Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator)
|
||||
{
|
||||
@@ -420,7 +420,7 @@ std::deque<int> PathManager::FindRoute(Map::Vertex Start, Map::Vertex End)
|
||||
}
|
||||
}
|
||||
|
||||
std::sort(SortedByDistance.begin(), SortedByDistance.end(), SortPathNodesByDistance);
|
||||
std::sort(SortedByDistance.begin(), SortedByDistance.end(), path_compare);
|
||||
|
||||
for(auto Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator)
|
||||
{
|
||||
@@ -1120,7 +1120,7 @@ int PathManager::FindNearestPathNode(Map::Vertex Position)
|
||||
}
|
||||
}
|
||||
|
||||
std::sort(SortedByDistance.begin(), SortedByDistance.end(), SortPathNodesByDistance);
|
||||
std::sort(SortedByDistance.begin(), SortedByDistance.end(), path_compare);
|
||||
|
||||
for(auto Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user