From a7fa3c7d8b625a954f25ebbb67c739263b64b0b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Zieli=C5=84ski?= Date: Tue, 30 Jul 2024 05:07:05 +0200 Subject: [PATCH] Ignore new connections for zone placement. --- lib/rmg/CZonePlacer.cpp | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/lib/rmg/CZonePlacer.cpp b/lib/rmg/CZonePlacer.cpp index 94719a983..29b1acfc6 100644 --- a/lib/rmg/CZonePlacer.cpp +++ b/lib/rmg/CZonePlacer.cpp @@ -80,12 +80,21 @@ void CZonePlacer::findPathsBetweenZones() for (auto & connection : connectedZoneIds) { - if (connection.getConnectionType() == rmg::EConnectionType::REPULSIVE) + switch (connection.getConnectionType()) { //Do not consider virtual connections for graph distance - continue; + case rmg::EConnectionType::REPULSIVE: + case rmg::EConnectionType::FORCE_PORTAL: + continue; } auto neighbor = connection.getOtherZoneId(current); + + if (current == neighbor) + { + //Do not consider self-connections + continue; + } + if (!visited[neighbor]) { visited[neighbor] = true; @@ -552,8 +561,16 @@ void CZonePlacer::attractConnectedZones(TZoneMap & zones, TForceVector & forces, for (const auto & connection : zone.second->getConnections()) { - if (connection.getConnectionType() == rmg::EConnectionType::REPULSIVE) + switch (connection.getConnectionType()) { + //Do not consider virtual connections for graph distance + case rmg::EConnectionType::REPULSIVE: + case rmg::EConnectionType::FORCE_PORTAL: + continue; + } + if (connection.getZoneA() == connection.getZoneB()) + { + //Do not consider self-connections continue; } @@ -710,11 +727,19 @@ void CZonePlacer::moveOneZone(TZoneMap& zones, TForceVector& totalForces, TDista std::set connectedZones; for (const auto& connection : firstZone->getConnections()) { - //FIXME: Should we also exclude fictive connections? - if (connection.getConnectionType() != rmg::EConnectionType::REPULSIVE) + switch (connection.getConnectionType()) { - connectedZones.insert(connection.getOtherZoneId(firstZone->getId())); + //Do not consider virtual connections for graph distance + case rmg::EConnectionType::REPULSIVE: + case rmg::EConnectionType::FORCE_PORTAL: + continue; } + if (connection.getZoneA() == connection.getZoneB()) + { + //Do not consider self-connections + continue; + } + connectedZones.insert(connection.getOtherZoneId(firstZone->getId())); } auto level = firstZone->getCenter().z;