mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-13 01:20:34 +02:00
Ignore new connections for zone placement.
This commit is contained in:
@ -80,12 +80,21 @@ void CZonePlacer::findPathsBetweenZones()
|
|||||||
|
|
||||||
for (auto & connection : connectedZoneIds)
|
for (auto & connection : connectedZoneIds)
|
||||||
{
|
{
|
||||||
if (connection.getConnectionType() == rmg::EConnectionType::REPULSIVE)
|
switch (connection.getConnectionType())
|
||||||
{
|
{
|
||||||
//Do not consider virtual connections for graph distance
|
//Do not consider virtual connections for graph distance
|
||||||
continue;
|
case rmg::EConnectionType::REPULSIVE:
|
||||||
|
case rmg::EConnectionType::FORCE_PORTAL:
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
auto neighbor = connection.getOtherZoneId(current);
|
auto neighbor = connection.getOtherZoneId(current);
|
||||||
|
|
||||||
|
if (current == neighbor)
|
||||||
|
{
|
||||||
|
//Do not consider self-connections
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!visited[neighbor])
|
if (!visited[neighbor])
|
||||||
{
|
{
|
||||||
visited[neighbor] = true;
|
visited[neighbor] = true;
|
||||||
@ -552,8 +561,16 @@ void CZonePlacer::attractConnectedZones(TZoneMap & zones, TForceVector & forces,
|
|||||||
|
|
||||||
for (const auto & connection : zone.second->getConnections())
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -710,11 +727,19 @@ void CZonePlacer::moveOneZone(TZoneMap& zones, TForceVector& totalForces, TDista
|
|||||||
std::set<TRmgTemplateZoneId> connectedZones;
|
std::set<TRmgTemplateZoneId> connectedZones;
|
||||||
for (const auto& connection : firstZone->getConnections())
|
for (const auto& connection : firstZone->getConnections())
|
||||||
{
|
{
|
||||||
//FIXME: Should we also exclude fictive connections?
|
switch (connection.getConnectionType())
|
||||||
if (connection.getConnectionType() != rmg::EConnectionType::REPULSIVE)
|
|
||||||
{
|
{
|
||||||
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;
|
auto level = firstZone->getCenter().z;
|
||||||
|
Reference in New Issue
Block a user