Explorar el Código

Use all tiles covered by treasure pile to determine distance to other treasures.

Tomasz Zieliński hace 2 años
padre
commit
66b6fba51f
Se han modificado 1 ficheros con 8 adiciones y 1 borrados
  1. 8 1
      lib/rmg/modificators/ObjectManager.cpp

+ 8 - 1
lib/rmg/modificators/ObjectManager.cpp

@@ -183,8 +183,15 @@ int3 ObjectManager::findPlaceForObject(const rmg::Area & searchArea, rmg::Object
 
 		for(const auto & t : obj.getArea().getTilesVector())
 		{
-			if(map.getTileInfo(t).getNearestObjectDistance() < min_dist)
+			auto localDist = map.getTileInfo(t).getNearestObjectDistance();
+			if (localDist < min_dist)
+			{
 				return -1.f;
+			}
+			else
+			{
+				vstd::amin(dist, localDist); //Evaluate object tile which will be closest to another object
+			}
 		}
 		
 		return dist;