MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / findClosestPath

Method findClosestPath

game/state/tilemap/pathfinding.cpp:1503–1519  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1501}
1502
1503std::list<Vec3<int>> RoadSegment::findClosestPath(Vec3<int> origin, Vec3<int> destination) const
1504{
1505 int closestDistance = INT_MAX;
1506 auto closestPoint = origin;
1507
1508 for (auto &p : tilePosition)
1509 {
1510 int distance = GroundVehicleTileHelper::getDistanceStatic(p, destination);
1511 if (distance < closestDistance)
1512 {
1513 closestDistance = distance;
1514 closestPoint = p;
1515 }
1516 }
1517
1518 return findPath(origin, closestPoint);
1519}
1520
1521std::list<Vec3<int>> RoadSegment::findPathThrough(int id) const
1522{

Callers 1

findShortestPathMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected