Skip to content

Commit

Permalink
Rename "override plugin" to "update plugin"
Browse files Browse the repository at this point in the history
To match the terminology used by Starfield's Creation Kit.
  • Loading branch information
Ortham committed Jun 28, 2024
1 parent 46c19a4 commit f6d4cea
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 32 deletions.
14 changes: 7 additions & 7 deletions include/loot/plugin_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down
14 changes: 7 additions & 7 deletions src/api/plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/api/plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
30 changes: 16 additions & 14 deletions src/tests/api/internals/plugin_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down Expand Up @@ -378,7 +378,7 @@ TEST_P(
}

TEST_P(PluginTest,
isOverridePluginShouldOnlyBeTrueForAStarfieldOverridePlugin) {
isUpdatePluginShouldOnlyBeTrueForAStarfieldUpdatePlugin) {
auto bytes = ReadFile(dataPath / blankMasterDependentEsp);
bytes[9] = 0x2;
WriteFile(dataPath / blankMasterDependentEsp, bytes);
Expand All @@ -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) {
Expand Down Expand Up @@ -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) {
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/tests/api/internals/sorting/plugin_graph_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; }

Expand Down

0 comments on commit f6d4cea

Please sign in to comment.