Skip to content

Commit

Permalink
#5622: No double-registering matching entities
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed May 23, 2021
1 parent 51512a6 commit 8fcc196
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions radiantcore/map/algorithm/Import.cpp
Expand Up @@ -447,16 +447,10 @@ ComparisonResult::Ptr compareGraphs(const scene::IMapRootNodePtr& target, const
for (const auto& targetEntity : targetEntities)
{
// Check each source node for an equivalent node in the target
auto matchingSourceNode = sourceEntities.find(targetEntity.first);

if (matchingSourceNode != sourceEntities.end())
{
// Found an equivalent node
result->equivalentEntities.emplace_back(ComparisonResult::Match{ targetEntity.first, matchingSourceNode->second, targetEntity.second });
}
else
// Matching nodes have already been checked in the above loop
if (sourceEntities.count(targetEntity.first) == 0)
{
result->differingEntities.emplace_back(ComparisonResult::Mismatch{ targetEntity.first, targetEntity.second });
result->differingEntities.emplace_back(ComparisonResult::Mismatch{ targetEntity.first, scene::INodePtr(), targetEntity.second });
}
}

Expand All @@ -471,9 +465,14 @@ ComparisonResult::Ptr compareGraphs(const scene::IMapRootNodePtr& target, const

for (const auto& mismatch : result->differingEntities)
{
rMessage() << " - Differing Entity " << mismatch.sourceNode->name() << std::endl;

// Check if there's a counter-part
if (mismatch.sourceNode)
{
rMessage() << " - No match found for source entity: " << mismatch.sourceNode->name() << std::endl;
}
else if (mismatch.targetNode)
{
rMessage() << " - No match found for target entity " << mismatch.targetNode->name() << std::endl;
}
}

return result;
Expand Down

0 comments on commit 8fcc196

Please sign in to comment.