mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Rename most mentions of FormIDs
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. This doesn't change PluginInterface::DoFormIDsOverlap() as that would be a breaking API change: that will be done separately.
This commit is contained in:
+6
-6
@@ -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;
|
||||
|
||||
+3
-3
@@ -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<const PluginInterface*>& 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<std::string> version_; // Obtained from description field.
|
||||
std::optional<uint32_t> crc_;
|
||||
std::vector<Tag> tags_;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<std::string> 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_);
|
||||
|
||||
@@ -52,8 +52,8 @@ public:
|
||||
bool IsMaster() const;
|
||||
bool LoadsArchive() const;
|
||||
std::vector<std::string> 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<File> userReq_;
|
||||
|
||||
std::optional<size_t> loadOrderIndex_;
|
||||
size_t numOverrideFormIDs{0};
|
||||
size_t overrideRecordCount_{0};
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user