From f6d4cea461e178f6448e64c1ef18c7095fdf9192 Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Tue, 25 Jun 2024 17:41:49 +0100 Subject: [PATCH] Rename "override plugin" to "update plugin" To match the terminology used by Starfield's Creation Kit. --- include/loot/plugin_interface.h | 14 ++++----- src/api/plugin.cpp | 14 ++++----- src/api/plugin.h | 4 +-- src/tests/api/internals/plugin_test.h | 30 ++++++++++--------- .../api/internals/sorting/plugin_graph_test.h | 4 +-- 5 files changed, 34 insertions(+), 32 deletions(-) diff --git a/include/loot/plugin_interface.h b/include/loot/plugin_interface.h index de335a94..c26c5f1f 100644 --- a/include/loot/plugin_interface.h +++ b/include/loot/plugin_interface.h @@ -106,10 +106,10 @@ class PluginInterface { virtual bool IsMediumPlugin() const = 0; /** - * Check if the plugin is an override plugin. - * @return True if plugin is an override plugin, false otherwise. + * Check if the plugin is an update plugin. + * @return True if plugin is an update plugin, false otherwise. */ - virtual bool IsOverridePlugin() const = 0; + virtual bool IsUpdatePlugin() const = 0; /** * Check if the plugin is or would be valid as a light plugin. @@ -126,11 +126,11 @@ class PluginInterface { virtual bool IsValidAsMediumPlugin() const = 0; /** - * Check if the plugin is or would be valid as an override plugin. - * @return True if the plugin is a valid override plugin or would be a valid - * override plugin, false otherwise. + * Check if the plugin is or would be valid as an update plugin. + * @return True if the plugin is a valid update plugin or would be a valid + * update plugin, false otherwise. */ - virtual bool IsValidAsOverridePlugin() const = 0; + virtual bool IsValidAsUpdatePlugin() const = 0; /** * Check if the plugin contains any records other than its TES4 header. diff --git a/src/api/plugin.cpp b/src/api/plugin.cpp index 871c65d6..27f01707 100644 --- a/src/api/plugin.cpp +++ b/src/api/plugin.cpp @@ -315,13 +315,13 @@ bool Plugin::IsMediumPlugin() const { return isMediumPlugin; } -bool Plugin::IsOverridePlugin() const { - bool isOverridePlugin = false; +bool Plugin::IsUpdatePlugin() const { + bool isUpdatePlugin = false; const auto ret = - esp_plugin_is_update_plugin(esPlugin.get(), &isOverridePlugin); - HandleEspluginError("check if \"" + name_ + "\" is an override plugin", ret); + esp_plugin_is_update_plugin(esPlugin.get(), &isUpdatePlugin); + HandleEspluginError("check if \"" + name_ + "\" is an update plugin", ret); - return isOverridePlugin; + return isUpdatePlugin; } bool Plugin::IsValidAsLightPlugin() const { @@ -344,12 +344,12 @@ bool Plugin::IsValidAsMediumPlugin() const { return isValid; } -bool Plugin::IsValidAsOverridePlugin() const { +bool Plugin::IsValidAsUpdatePlugin() const { bool isValid = false; const auto ret = esp_plugin_is_valid_as_update_plugin(esPlugin.get(), &isValid); HandleEspluginError( - "check if \"" + name_ + "\" is valid as an override plugin", ret); + "check if \"" + name_ + "\" is valid as an update plugin", ret); return isValid; } diff --git a/src/api/plugin.h b/src/api/plugin.h index fce6b107..9b6c4137 100644 --- a/src/api/plugin.h +++ b/src/api/plugin.h @@ -73,11 +73,11 @@ class Plugin final : public PluginSortingInterface { bool IsLightPlugin() const override; bool IsMediumPlugin() const override; - bool IsOverridePlugin() const override; + bool IsUpdatePlugin() const override; bool IsValidAsLightPlugin() const override; bool IsValidAsMediumPlugin() const override; - bool IsValidAsOverridePlugin() const override; + bool IsValidAsUpdatePlugin() const override; bool IsEmpty() const override; bool LoadsArchive() const override; bool DoRecordsOverlap(const PluginInterface& plugin) const override; diff --git a/src/tests/api/internals/plugin_test.h b/src/tests/api/internals/plugin_test.h index 112a3d58..b42485ea 100644 --- a/src/tests/api/internals/plugin_test.h +++ b/src/tests/api/internals/plugin_test.h @@ -198,10 +198,10 @@ class OtherPluginType final : public PluginSortingInterface { bool IsMaster() const override { return false; } bool IsLightPlugin() const override { return false; } bool IsMediumPlugin() const override { return false; } - bool IsOverridePlugin() const override { return false; } + bool IsUpdatePlugin() const override { return false; } bool IsValidAsLightPlugin() const override { return false; } bool IsValidAsMediumPlugin() const override { return false; } - bool IsValidAsOverridePlugin() const override { return false; } + bool IsValidAsUpdatePlugin() const override { return false; } bool IsEmpty() const override { return false; } bool LoadsArchive() const override { return false; } bool DoRecordsOverlap(const PluginInterface&) const override { return true; } @@ -378,7 +378,7 @@ TEST_P( } TEST_P(PluginTest, - isOverridePluginShouldOnlyBeTrueForAStarfieldOverridePlugin) { + isUpdatePluginShouldOnlyBeTrueForAStarfieldUpdatePlugin) { auto bytes = ReadFile(dataPath / blankMasterDependentEsp); bytes[9] = 0x2; WriteFile(dataPath / blankMasterDependentEsp, bytes); @@ -390,8 +390,8 @@ TEST_P(PluginTest, game_.DataPath() / blankMasterDependentEsp, true); - EXPECT_FALSE(plugin1.IsOverridePlugin()); - EXPECT_EQ(GetParam() == GameType::starfield, plugin2.IsOverridePlugin()); + EXPECT_FALSE(plugin1.IsUpdatePlugin()); + EXPECT_EQ(GetParam() == GameType::starfield, plugin2.IsUpdatePlugin()); } TEST_P(PluginTest, loadingAPluginWithMastersShouldReadThemCorrectly) { @@ -580,19 +580,21 @@ TEST_P( TEST_P( PluginTest, - IsValidAsOverridePluginShouldOnlyReturnTrueForAStarfieldPluginWithNoNewRecords) { - const auto sourcePluginName = - GetParam() == GameType::starfield ? blankFullEsm : blankEsp; - const auto overridePluginName = GetParam() == GameType::starfield - ? blankMasterDependentEsp - : blankDifferentPluginDependentEsp; + IsValidAsUpdatePluginShouldOnlyReturnTrueForAStarfieldPluginWithNoNewRecords) { + const auto sourcePluginName = GetParam() == GameType::starfield + ? blankFullEsm + : blankEsp; + const auto updatePluginName = GetParam() == GameType::starfield + ? blankMasterDependentEsp + : blankDifferentPluginDependentEsp; + Plugin plugin1(game_.GetType(), game_.GetCache(), game_.DataPath() / sourcePluginName, false); Plugin plugin2(game_.GetType(), game_.GetCache(), - game_.DataPath() / overridePluginName, + game_.DataPath() / updatePluginName, false); if (GetParam() == GameType::starfield) { @@ -603,9 +605,9 @@ TEST_P( plugin2.ResolveRecordIds(nullptr); } - EXPECT_FALSE(plugin1.IsValidAsOverridePlugin()); + EXPECT_FALSE(plugin1.IsValidAsUpdatePlugin()); EXPECT_EQ(GetParam() == GameType::starfield, - plugin2.IsValidAsOverridePlugin()); + plugin2.IsValidAsUpdatePlugin()); } 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 97a565ad..8b846cb4 100644 --- a/src/tests/api/internals/sorting/plugin_graph_test.h +++ b/src/tests/api/internals/sorting/plugin_graph_test.h @@ -62,13 +62,13 @@ class TestPlugin : public PluginSortingInterface { bool IsMediumPlugin() const override { return false; } - bool IsOverridePlugin() const override { return false; } + bool IsUpdatePlugin() const override { return false; } bool IsValidAsLightPlugin() const override { return false; } bool IsValidAsMediumPlugin() const override { return false; } - bool IsValidAsOverridePlugin() const override { return false; } + bool IsValidAsUpdatePlugin() const override { return false; } bool IsEmpty() const override { return false; }