From fbc503a363608e00819014d011777535fc59f84a Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Thu, 15 Dec 2022 18:11:07 +0000 Subject: [PATCH] Rename PluginInterface::DoFormIDsOverlap() The use of FormIDs doesn't apply to Morrowind and it's really the records that are significant - FormIDs are an implementation detail. This also aligns with other use of records in names. --- include/loot/plugin_interface.h | 2 +- src/api/plugin.cpp | 2 +- src/api/plugin.h | 2 +- src/api/sorting/plugin_sorting_data.cpp | 2 +- src/tests/api/internals/plugin_test.h | 26 +++++++++---------- .../api/internals/sorting/plugin_graph_test.h | 2 +- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/include/loot/plugin_interface.h b/include/loot/plugin_interface.h index 17658006..73bb2943 100644 --- a/include/loot/plugin_interface.h +++ b/include/loot/plugin_interface.h @@ -126,7 +126,7 @@ public: * Morrowind, which doesn't have FormIDs and so has other identifying * data compared. */ - virtual bool DoFormIDsOverlap(const PluginInterface& plugin) const = 0; + virtual bool DoRecordsOverlap(const PluginInterface& plugin) const = 0; }; } diff --git a/src/api/plugin.cpp b/src/api/plugin.cpp index 2d39a7e0..8e66f27d 100644 --- a/src/api/plugin.cpp +++ b/src/api/plugin.cpp @@ -280,7 +280,7 @@ bool Plugin::IsEmpty() const { return isEmpty_; } bool Plugin::LoadsArchive() const { return !archivePaths_.empty(); } -bool Plugin::DoFormIDsOverlap(const PluginInterface& plugin) const { +bool Plugin::DoRecordsOverlap(const PluginInterface& plugin) const { try { auto& otherPlugin = dynamic_cast(plugin); diff --git a/src/api/plugin.h b/src/api/plugin.h index 3ee8e36e..cbe2c743 100644 --- a/src/api/plugin.h +++ b/src/api/plugin.h @@ -74,7 +74,7 @@ public: bool IsValidAsLightPlugin() const override; bool IsEmpty() const override; bool LoadsArchive() const override; - bool DoFormIDsOverlap(const PluginInterface& plugin) const override; + bool DoRecordsOverlap(const PluginInterface& plugin) const override; size_t GetOverlapSize( const std::vector& plugins) const override; diff --git a/src/api/sorting/plugin_sorting_data.cpp b/src/api/sorting/plugin_sorting_data.cpp index 1f0834d5..b9930221 100644 --- a/src/api/sorting/plugin_sorting_data.cpp +++ b/src/api/sorting/plugin_sorting_data.cpp @@ -134,7 +134,7 @@ size_t PluginSortingData::GetOverrideRecordCount() const { bool PluginSortingData::DoRecordsOverlap( const PluginSortingData& plugin) const { return plugin_ != nullptr && plugin.plugin_ != nullptr && - plugin_->DoFormIDsOverlap(*plugin.plugin_); + plugin_->DoRecordsOverlap(*plugin.plugin_); } size_t PluginSortingData::GetAssetCount() const { diff --git a/src/tests/api/internals/plugin_test.h b/src/tests/api/internals/plugin_test.h index e3a12bf8..ed2fc373 100644 --- a/src/tests/api/internals/plugin_test.h +++ b/src/tests/api/internals/plugin_test.h @@ -179,7 +179,7 @@ public: bool IsValidAsLightPlugin() const override { return false; } bool IsEmpty() const override { return false; } bool LoadsArchive() const override { return false; } - bool DoFormIDsOverlap(const PluginInterface&) const override { return true; } + bool DoRecordsOverlap(const PluginInterface&) const override { return true; } size_t GetOverrideRecordCount() const override { return 0; }; uint32_t GetRecordAndGroupCount() const override { return 0; }; @@ -477,17 +477,17 @@ TEST_P(PluginTest, getFileSizeShouldReturnCorrectValueForAGhostedPlugin) { } TEST_P(PluginTest, - DoFormIDsOverlapShouldReturnFalseIfTheArgumentIsNotAPluginObject) { + doRecordsOverlapShouldReturnFalseIfTheArgumentIsNotAPluginObject) { Plugin plugin1( game_.Type(), game_.GetCache(), game_.DataPath() / blankEsm, false); OtherPluginType plugin2; - EXPECT_FALSE(plugin1.DoFormIDsOverlap(plugin2)); - EXPECT_TRUE(plugin2.DoFormIDsOverlap(plugin1)); + EXPECT_FALSE(plugin1.DoRecordsOverlap(plugin2)); + EXPECT_TRUE(plugin2.DoRecordsOverlap(plugin1)); } TEST_P(PluginTest, - DoFormIDsOverlapShouldReturnFalseForTwoPluginsWithOnlyHeadersLoaded) { + doRecordsOverlapShouldReturnFalseForTwoPluginsWithOnlyHeadersLoaded) { Plugin plugin1( game_.Type(), game_.GetCache(), game_.DataPath() / blankEsm, true); Plugin plugin2(game_.Type(), @@ -495,23 +495,23 @@ TEST_P(PluginTest, game_.DataPath() / blankMasterDependentEsm, true); - EXPECT_FALSE(plugin1.DoFormIDsOverlap(plugin2)); - EXPECT_FALSE(plugin2.DoFormIDsOverlap(plugin1)); + EXPECT_FALSE(plugin1.DoRecordsOverlap(plugin2)); + EXPECT_FALSE(plugin2.DoRecordsOverlap(plugin1)); } TEST_P(PluginTest, - DoFormIDsOverlapShouldReturnFalseIfThePluginsHaveUnrelatedRecords) { + doRecordsOverlapShouldReturnFalseIfThePluginsHaveUnrelatedRecords) { Plugin plugin1( game_.Type(), game_.GetCache(), game_.DataPath() / blankEsm, false); Plugin plugin2( game_.Type(), game_.GetCache(), game_.DataPath() / blankEsp, false); - EXPECT_FALSE(plugin1.DoFormIDsOverlap(plugin2)); - EXPECT_FALSE(plugin2.DoFormIDsOverlap(plugin1)); + EXPECT_FALSE(plugin1.DoRecordsOverlap(plugin2)); + EXPECT_FALSE(plugin2.DoRecordsOverlap(plugin1)); } TEST_P(PluginTest, - DoFormIDsOverlapShouldReturnTrueIfOnePluginOverridesTheOthersRecords) { + doRecordsOverlapShouldReturnTrueIfOnePluginOverridesTheOthersRecords) { Plugin plugin1( game_.Type(), game_.GetCache(), game_.DataPath() / blankEsm, false); Plugin plugin2(game_.Type(), @@ -519,8 +519,8 @@ TEST_P(PluginTest, game_.DataPath() / blankMasterDependentEsm, false); - EXPECT_TRUE(plugin1.DoFormIDsOverlap(plugin2)); - EXPECT_TRUE(plugin2.DoFormIDsOverlap(plugin1)); + EXPECT_TRUE(plugin1.DoRecordsOverlap(plugin2)); + EXPECT_TRUE(plugin2.DoRecordsOverlap(plugin1)); } TEST_P(PluginTest, diff --git a/src/tests/api/internals/sorting/plugin_graph_test.h b/src/tests/api/internals/sorting/plugin_graph_test.h index e3094d4d..80da1934 100644 --- a/src/tests/api/internals/sorting/plugin_graph_test.h +++ b/src/tests/api/internals/sorting/plugin_graph_test.h @@ -66,7 +66,7 @@ public: bool LoadsArchive() const override { return false; } - bool DoFormIDsOverlap(const PluginInterface& plugin) const override { + bool DoRecordsOverlap(const PluginInterface& plugin) const override { const auto otherPlugin = dynamic_cast(&plugin); return recordsOverlapWith.count(&plugin) != 0 || otherPlugin->recordsOverlapWith.count(this) != 0;