diff --git a/src/api/plugin.cpp b/src/api/plugin.cpp index 4d8e9135..8748c7c9 100644 --- a/src/api/plugin.cpp +++ b/src/api/plugin.cpp @@ -44,7 +44,7 @@ Plugin::Plugin(const GameType gameType, esp_plugin_free)), isEmpty_(true), loadsArchive_(false), - numOverrideRecords_(0) { + overrideRecordCount_(0) { auto logger = getLogger(); try { @@ -66,7 +66,7 @@ Plugin::Plugin(const GameType gameType, crc_ = GetCrc32(pluginPath); ret = esp_plugin_count_override_records(esPlugin.get(), - &numOverrideRecords_); + &overrideRecordCount_); if (ret != ESP_OK) { throw FileAccessError( "Error counting override records in \"" + name_ + @@ -183,7 +183,7 @@ bool Plugin::DoFormIDsOverlap(const PluginInterface& plugin) const { auto logger = getLogger(); if (logger) { logger->error( - "Tried to check if FormIDs overlapped with a non-Plugin " + "Tried to check if records overlapped with a non-Plugin " "implementation of PluginInterface."); } } @@ -205,11 +205,11 @@ size_t Plugin::GetOverlapSize( const auto logger = getLogger(); if (logger) { logger->error( - "Tried to check how many FormIDs overlapped with a non-Plugin " + "Tried to check how many records overlapped with a non-Plugin " "implementation of PluginSortingInterface."); } throw std::invalid_argument( - "Tried to check how many FormIDs overlapped with a non-Plugin " + "Tried to check how many records overlapped with a non-Plugin " "implementation of PluginSortingInterface."); } @@ -227,7 +227,7 @@ size_t Plugin::GetOverlapSize( return overlapSize; } -size_t Plugin::NumOverrideFormIDs() const { return numOverrideRecords_; } +size_t Plugin::GetOverrideRecordCount() const { return overrideRecordCount_; } uint32_t Plugin::GetRecordAndGroupCount() const { uint32_t recordAndGroupCount = 0; diff --git a/src/api/plugin.h b/src/api/plugin.h index b50d2968..ff1c9759 100644 --- a/src/api/plugin.h +++ b/src/api/plugin.h @@ -42,7 +42,7 @@ class GameCache; // An interface containing member functions that are used when sorting plugins. class PluginSortingInterface : public PluginInterface { public: - virtual size_t NumOverrideFormIDs() const = 0; + virtual size_t GetOverrideRecordCount() const = 0; virtual uint32_t GetRecordAndGroupCount() const = 0; virtual size_t GetOverlapSize( @@ -75,7 +75,7 @@ public: const std::vector& plugins) const override; // Load ordering functions. - size_t NumOverrideFormIDs() const override; + size_t GetOverrideRecordCount() const override; uint32_t GetRecordAndGroupCount() const override; // Validity checks. @@ -99,7 +99,7 @@ private: bool isEmpty_; // Does the plugin contain any records other than the TES4 // header? bool loadsArchive_; - size_t numOverrideRecords_; + size_t overrideRecordCount_; std::optional version_; // Obtained from description field. std::optional crc_; std::vector tags_; diff --git a/src/api/sorting/plugin_graph.cpp b/src/api/sorting/plugin_graph.cpp index aa1cdd9b..422eb3f5 100644 --- a/src/api/sorting/plugin_graph.cpp +++ b/src/api/sorting/plugin_graph.cpp @@ -778,7 +778,7 @@ void PluginGraph::AddOverlapEdges() { const auto vertex = *vit; const auto& plugin = GetPlugin(vertex); - if (plugin.NumOverrideFormIDs() == 0) { + if (plugin.GetOverrideRecordCount() == 0) { if (logger) { logger->debug( "Skipping vertex for \"{}\": the plugin contains no override " @@ -794,16 +794,16 @@ void PluginGraph::AddOverlapEdges() { if (vertex == otherVertex || EdgeExists(vertex, otherVertex) || EdgeExists(otherVertex, vertex) || - plugin.NumOverrideFormIDs() == otherPlugin.NumOverrideFormIDs() || - !plugin.DoFormIDsOverlap(otherPlugin)) { + plugin.GetOverrideRecordCount() == otherPlugin.GetOverrideRecordCount() || + !plugin.DoRecordsOverlap(otherPlugin)) { continue; } - const auto thisPluginOverridesMoreFormIDs = - plugin.NumOverrideFormIDs() > otherPlugin.NumOverrideFormIDs(); + const auto thisPluginOverridesMoreRecords = + plugin.GetOverrideRecordCount() > otherPlugin.GetOverrideRecordCount(); const auto fromVertex = - thisPluginOverridesMoreFormIDs ? vertex : otherVertex; - const auto toVertex = thisPluginOverridesMoreFormIDs ? otherVertex : vertex; + thisPluginOverridesMoreRecords ? vertex : otherVertex; + const auto toVertex = thisPluginOverridesMoreRecords ? otherVertex : vertex; if (!PathExists(toVertex, fromVertex)) AddEdge(fromVertex, toVertex, EdgeType::overlap); diff --git a/src/api/sorting/plugin_sorting_data.cpp b/src/api/sorting/plugin_sorting_data.cpp index 02c782e1..e2fa005b 100644 --- a/src/api/sorting/plugin_sorting_data.cpp +++ b/src/api/sorting/plugin_sorting_data.cpp @@ -83,11 +83,11 @@ PluginSortingData::PluginSortingData( if (gameType == GameType::tes3) { auto masterNames = plugin->GetMasters(); if (masterNames.empty()) { - numOverrideFormIDs = 0; + overrideRecordCount_ = 0; } else { auto masters = GetPluginsSubset(loadedPlugins, masterNames); if (masters.size() == masterNames.size()) { - numOverrideFormIDs = plugin->GetOverlapSize(masters); + overrideRecordCount_ = plugin->GetOverlapSize(masters); } else { // Not all masters are loaded, fall back to using the plugin's // total record count (Morrowind doesn't have groups). This is OK @@ -98,11 +98,11 @@ PluginSortingData::PluginSortingData( // order with missing masters with potentially poorer results than // for it to error out, as masters may be missing for a variety of // development & testing reasons. - numOverrideFormIDs = plugin->GetRecordAndGroupCount(); + overrideRecordCount_ = plugin->GetRecordAndGroupCount(); } } } else { - numOverrideFormIDs = plugin->NumOverrideFormIDs(); + overrideRecordCount_ = plugin->GetOverrideRecordCount(); } } @@ -127,11 +127,11 @@ std::vector PluginSortingData::GetMasters() const { return plugin_->GetMasters(); } -size_t PluginSortingData::NumOverrideFormIDs() const { - return numOverrideFormIDs; +size_t PluginSortingData::GetOverrideRecordCount() const { + return overrideRecordCount_; } -bool PluginSortingData::DoFormIDsOverlap( +bool PluginSortingData::DoRecordsOverlap( const PluginSortingData& plugin) const { return plugin_ != nullptr && plugin.plugin_ != nullptr && plugin_->DoFormIDsOverlap(*plugin.plugin_); diff --git a/src/api/sorting/plugin_sorting_data.h b/src/api/sorting/plugin_sorting_data.h index 8b9d759a..06111cec 100644 --- a/src/api/sorting/plugin_sorting_data.h +++ b/src/api/sorting/plugin_sorting_data.h @@ -52,8 +52,8 @@ public: bool IsMaster() const; bool LoadsArchive() const; std::vector GetMasters() const; - size_t NumOverrideFormIDs() const; - bool DoFormIDsOverlap(const PluginSortingData& plugin) const; + size_t GetOverrideRecordCount() const; + bool DoRecordsOverlap(const PluginSortingData& plugin) const; std::string GetGroup() const; @@ -78,7 +78,7 @@ private: std::vector userReq_; std::optional loadOrderIndex_; - size_t numOverrideFormIDs{0}; + size_t overrideRecordCount_{0}; }; } diff --git a/src/tests/api/internals/plugin_test.h b/src/tests/api/internals/plugin_test.h index 43a97a6e..9f759f59 100644 --- a/src/tests/api/internals/plugin_test.h +++ b/src/tests/api/internals/plugin_test.h @@ -156,7 +156,7 @@ public: bool LoadsArchive() const override { return false; } bool DoFormIDsOverlap(const PluginInterface&) const override { return true; } - size_t NumOverrideFormIDs() const override { return 0; }; + size_t GetOverrideRecordCount() const override { return 0; }; uint32_t GetRecordAndGroupCount() const override { return 0; }; size_t GetOverlapSize( @@ -239,9 +239,9 @@ TEST_P(PluginTest, loadingWholePluginShouldReadFields) { false); if (GetParam() == GameType::tes3) { - EXPECT_EQ(0, plugin.NumOverrideFormIDs()); + EXPECT_EQ(0, plugin.GetOverrideRecordCount()); } else { - EXPECT_EQ(4, plugin.NumOverrideFormIDs()); + EXPECT_EQ(4, plugin.GetOverrideRecordCount()); } } @@ -447,7 +447,7 @@ TEST_P(PluginTest, getFileSizeShouldReturnCorrectValueForAGhostedPlugin) { } TEST_P(PluginTest, - doFormIDsOverlapShouldReturnFalseIfTheArgumentIsNotAPluginObject) { + DoFormIDsOverlapShouldReturnFalseIfTheArgumentIsNotAPluginObject) { Plugin plugin1( game_.Type(), game_.GetCache(), game_.DataPath() / blankEsm, false); OtherPluginType plugin2; @@ -457,7 +457,7 @@ TEST_P(PluginTest, } TEST_P(PluginTest, - doFormIDsOverlapShouldReturnFalseForTwoPluginsWithOnlyHeadersLoaded) { + DoFormIDsOverlapShouldReturnFalseForTwoPluginsWithOnlyHeadersLoaded) { Plugin plugin1( game_.Type(), game_.GetCache(), game_.DataPath() / blankEsm, true); Plugin plugin2(game_.Type(), @@ -470,7 +470,7 @@ TEST_P(PluginTest, } TEST_P(PluginTest, - doFormIDsOverlapShouldReturnFalseIfThePluginsHaveUnrelatedRecords) { + DoFormIDsOverlapShouldReturnFalseIfThePluginsHaveUnrelatedRecords) { Plugin plugin1( game_.Type(), game_.GetCache(), game_.DataPath() / blankEsm, false); Plugin plugin2( @@ -481,7 +481,7 @@ TEST_P(PluginTest, } TEST_P(PluginTest, - doFormIDsOverlapShouldReturnTrueIfOnePluginOverridesTheOthersRecords) { + DoFormIDsOverlapShouldReturnTrueIfOnePluginOverridesTheOthersRecords) { Plugin plugin1( game_.Type(), game_.GetCache(), game_.DataPath() / blankEsm, false); Plugin plugin2(game_.Type(), diff --git a/src/tests/api/internals/sorting/plugin_sorting_data_test.h b/src/tests/api/internals/sorting/plugin_sorting_data_test.h index 836cbfec..84d95621 100644 --- a/src/tests/api/internals/sorting/plugin_sorting_data_test.h +++ b/src/tests/api/internals/sorting/plugin_sorting_data_test.h @@ -137,7 +137,7 @@ TEST_P(PluginSortingDataTest, lightFlaggedEspFilesShouldNotBeTreatedAsMasters) { } TEST_P(PluginSortingDataTest, - numOverrideFormIdsShouldEqualSizeOfOverlapWithThePluginsMasters) { + overrideRecordCountShouldEqualSizeOfOverlapWithThePluginsMasters) { ASSERT_NO_THROW(loadInstalledPlugins(game_, false)); auto plugin = PluginSortingData( @@ -147,12 +147,12 @@ TEST_P(PluginSortingDataTest, getLoadOrder(), game_.Type(), getLoadedPlugins()); - EXPECT_EQ(4, plugin.NumOverrideFormIDs()); + EXPECT_EQ(4, plugin.GetOverrideRecordCount()); } TEST_P( PluginSortingDataTest, - constructorShouldUseTotalRecordCountAsOverrideFormIdCountForTes3PluginWithAMasterThatIsNotLoaded) { + constructorShouldUseTotalRecordCountAsOverrideRecordCountForTes3PluginWithAMasterThatIsNotLoaded) { if (GetParam() != GameType::tes3) { return; } @@ -177,7 +177,7 @@ TEST_P( game_.Type(), loadedPlugins); - EXPECT_EQ(10, plugin.NumOverrideFormIDs()); + EXPECT_EQ(10, plugin.GetOverrideRecordCount()); } } }