1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-10 22:31:40 +02:00

Remove unused method, rename the other one

This commit is contained in:
Tomasz Zieliński
2025-03-14 08:27:53 +01:00
parent 56b3867bb3
commit 363e83e78a
3 changed files with 4 additions and 16 deletions

View File

@@ -190,18 +190,7 @@ const Area & Path::getPathArea() const
return dPath;
}
float Path::nonEuclideanCostFunction(const int3& src, const int3& dst)
{
// Use non-euclidean metric
int dx = std::abs(src.x - dst.x);
int dy = std::abs(src.y - dst.y);
// int dx = src.x - dst.x;
// int dy = src.y - dst.y;
return std::sqrt(dx * dx + dy * dy) -
500 * std::sin(dx * dy / 20);
}
float Path::curvedCost(const int3& src, const int3& dst, const int3& center)
float Path::nonEuclideanCostFunction(const int3& src, const int3& dst, const int3& center)
{
float R = 30.0f; // radius of the zone
float W = 10.0f;// width of the transition area
@@ -228,7 +217,7 @@ Path::MoveCostFunction Path::createCurvedCostFunction(const Area & border)
// Capture by value to ensure the Area object persists
return [border = border](const int3& src, const int3& dst) -> float
{
float ret = curvedCost(src, dst, border.getCenterOfMass());
float ret = nonEuclideanCostFunction(src, dst, border.getCenterOfMass());
// Route main roads far from border
float dist = border.distanceSqr(dst);

View File

@@ -44,9 +44,8 @@ public:
const Area & getPathArea() const;
static Path invalid();
static float nonEuclideanCostFunction(const int3& src, const int3& dst);
static float curvedCost(const int3& src, const int3& dst, const int3& center);
static MoveCostFunction createCurvedCostFunction(const Area & border);
static float nonEuclideanCostFunction(const int3& src, const int3& dst, const int3& center);
private:

View File

@@ -93,7 +93,7 @@ bool RoadPlacer::createRoad(const int3 & destination)
}
}
float ret = rmg::Path::curvedCost(src, dst, border.getCenterOfMass());
float ret = rmg::Path::nonEuclideanCostFunction(src, dst, border.getCenterOfMass());
if (visitableTiles.contains(src) || visitableTiles.contains(dst))
{