mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-16 02:47:36 +02:00
Place objects away from wide connection
This commit is contained in:
parent
47726625c2
commit
8510af487e
@ -147,6 +147,7 @@ void ConnectionsPlacer::selfSideDirectConnection(const rmg::ZoneConnection & con
|
|||||||
{
|
{
|
||||||
zone.connectPath(ourPath);
|
zone.connectPath(ourPath);
|
||||||
otherZone->connectPath(theirPath);
|
otherZone->connectPath(theirPath);
|
||||||
|
otherZone->getModificator<ObjectManager>()->updateDistances(potentialPos);
|
||||||
|
|
||||||
success = true;
|
success = true;
|
||||||
break;
|
break;
|
||||||
|
@ -86,6 +86,18 @@ void ObjectManager::updateDistances(const rmg::Object & obj)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ObjectManager::updateDistances(const int3 & pos)
|
||||||
|
{
|
||||||
|
RecursiveLock lock(externalAccessMutex);
|
||||||
|
tilesByDistance.clear();
|
||||||
|
for (auto tile : zone.areaPossible().getTiles()) //don't need to mark distance for not possible tiles
|
||||||
|
{
|
||||||
|
ui32 d = pos.dist2dSQ(tile); //optimization, only relative distance is interesting
|
||||||
|
map.setNearestObjectDistance(tile, std::min(static_cast<float>(d), map.getNearestObjectDistance(tile)));
|
||||||
|
tilesByDistance.push(std::make_pair(tile, map.getNearestObjectDistance(tile)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const rmg::Area & ObjectManager::getVisitableArea() const
|
const rmg::Area & ObjectManager::getVisitableArea() const
|
||||||
{
|
{
|
||||||
RecursiveLock lock(externalAccessMutex);
|
RecursiveLock lock(externalAccessMutex);
|
||||||
|
@ -62,6 +62,7 @@ public:
|
|||||||
void placeObject(rmg::Object & object, bool guarded, bool updateDistance);
|
void placeObject(rmg::Object & object, bool guarded, bool updateDistance);
|
||||||
|
|
||||||
void updateDistances(const rmg::Object & obj);
|
void updateDistances(const rmg::Object & obj);
|
||||||
|
void updateDistances(const int3& pos);
|
||||||
void createDistancesPriorityQueue();
|
void createDistancesPriorityQueue();
|
||||||
|
|
||||||
const rmg::Area & getVisitableArea() const;
|
const rmg::Area & getVisitableArea() const;
|
||||||
|
Loading…
Reference in New Issue
Block a user