diff --git a/src/api/sorting/plugin_graph.cpp b/src/api/sorting/plugin_graph.cpp index a5b18d37..72fe2c78 100644 --- a/src/api/sorting/plugin_graph.cpp +++ b/src/api/sorting/plugin_graph.cpp @@ -309,6 +309,16 @@ std::optional PluginGraph::GetVertexByName( return std::nullopt; } +std::optional PluginGraph::GetVertexByExactName( + const std::string& name) const { + const auto it = pluginNameVertexMap.find(name); + if (it != pluginNameVertexMap.end()) { + return it->second; + } + + return std::nullopt; +} + const PluginSortingData& PluginGraph::GetPlugin(const vertex_t& vertex) const { return graph_[vertex]; } @@ -441,7 +451,8 @@ void PluginGraph::AddEdge(const vertex_t& fromVertex, } void PluginGraph::AddVertex(const PluginSortingData& plugin) { - boost::add_vertex(plugin, graph_); + const auto vertex = boost::add_vertex(plugin, graph_); + pluginNameVertexMap.emplace(plugin.GetName(), vertex); } void PluginGraph::AddPluginVertices(const Game& game, @@ -669,7 +680,9 @@ void PluginGraph::AddGroupEdges( const auto& toPlugin = GetPlugin(vertex); for (const auto& pluginName : toPlugin.GetAfterGroupPlugins()) { - const auto parentVertex = GetVertexByName(pluginName); + // After group plugin names are taken from other PluginSortingData names, + // so exact string comparisons can be used. + const auto parentVertex = GetVertexByExactName(pluginName); if (!parentVertex.has_value()) { continue; } diff --git a/src/api/sorting/plugin_graph.h b/src/api/sorting/plugin_graph.h index 81865add..631ca662 100644 --- a/src/api/sorting/plugin_graph.h +++ b/src/api/sorting/plugin_graph.h @@ -65,6 +65,7 @@ public: size_t CountVertices() const; std::pair GetVertices() const; std::optional GetVertexByName(const std::string& name) const; + std::optional GetVertexByExactName(const std::string& name) const; const PluginSortingData& GetPlugin(const vertex_t& vertex) const; @@ -97,6 +98,7 @@ public: private: RawPluginGraph graph_; PathsCache pathsCache_; + std::map pluginNameVertexMap; }; }