Ver código fonte

Remove unused method, rename the other one

Tomasz Zieliński 8 meses atrás
pai
commit
363e83e78a
3 arquivos alterados com 4 adições e 16 exclusões
  1. 2 13
      lib/rmg/RmgPath.cpp
  2. 1 2
      lib/rmg/RmgPath.h
  3. 1 1
      lib/rmg/modificators/RoadPlacer.cpp

+ 2 - 13
lib/rmg/RmgPath.cpp

@@ -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);
 

+ 1 - 2
lib/rmg/RmgPath.h

@@ -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:
 	

+ 1 - 1
lib/rmg/modificators/RoadPlacer.cpp

@@ -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))
 		{