From 66b6fba51f8bdbba576c5c0c98159cb1c2105e13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Zieli=C5=84ski?= Date: Thu, 8 Jun 2023 19:31:38 +0200 Subject: [PATCH] Use all tiles covered by treasure pile to determine distance to other treasures. --- lib/rmg/modificators/ObjectManager.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/rmg/modificators/ObjectManager.cpp b/lib/rmg/modificators/ObjectManager.cpp index 52c3eb8ce..5b7b051c8 100644 --- a/lib/rmg/modificators/ObjectManager.cpp +++ b/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;