diff --git a/docs/LOOT Metadata Syntax.html b/docs/LOOT Metadata Syntax.html index 1d8c0880..f91788fc 100644 --- a/docs/LOOT Metadata Syntax.html +++ b/docs/LOOT Metadata Syntax.html @@ -322,6 +322,24 @@ nav: 0
urldirtyEach plugin must have only one matching non-regex entry. If multiple non-regex entries exist with the same name value, all but the first will be ignored. A plugin may match any number of regex entries though, and their metadata will be merged, with later entries being merged into earlier entries as detailed in the table below. Merging only takes place if both entries have their enabled value set to true (which is the default if unspecified).
+
+
| Key Name | Merge Behaviour (merging B into A) + |
|---|---|
name | Not merged. + |
enabled | Replaced but must be `true` anyway. + |
priority | Replaced by B's value. + |
after | Merged. If A and B both contain an entry with the same name value, B's copy is skipped.
+ |
req | Merged. If A and B both contain an entry with the same name value, B's copy is skipped.
+ |
inc | Merged. If A and B both contain an entry with the same name value, B's copy is skipped.
+ |
msg | Merged. If A and B both contain an entry with the same content string (if there are multiple content strings, the first is checked), then B's copy is skipped. + |
tag | Merged. If A and B both contain an entry with the same name value, B's copy is skipped, unless one is suggesting the tag for addition and the other is suggesting it for removal, in which case both entries are kept.
+ |
url | Currently skipped by the parser, so neither A nor B will contain any entries anyway. + |
dirty | Merged. If A and B both contain an entry with the same crc value, B's copy is skipped.
+ |
Example:
name: 'Oscuro''s_Oblivion_Overhaul.esm'
req:
diff --git a/src/backend/game.cpp b/src/backend/game.cpp
index 335acc4f..83780ce2 100644
--- a/src/backend/game.cpp
+++ b/src/backend/game.cpp
@@ -180,18 +180,24 @@ namespace loot {
return pluginList;
}
+ // Merges multiple matching regex entries if any are found.
Plugin MetadataList::FindPlugin(const Plugin& plugin) const {
+ Plugin match(plugin.Name());
+
auto it = plugins.find(plugin);
if (it != plugins.end())
- return *it;
+ match = *it;
+ // Now we want to also match possibly multiple regex entries.
it = find(regexPlugins.begin(), regexPlugins.end(), plugin);
+ while (it != regexPlugins.end()) {
+ match.MergeMetadata(*it);
- if (it != regexPlugins.end())
- return *it;
- else
- return Plugin(plugin.Name());
+ it = find(++it, regexPlugins.end(), plugin);
+ }
+
+ return match;
}
void MetadataList::AddPlugin(const Plugin& plugin) {
@@ -201,6 +207,8 @@ namespace loot {
plugins.insert(plugin);
}
+ // Doesn't erase matching regex entries, because they might also
+ // be required for other plugins.
void MetadataList::ErasePlugin(const Plugin& plugin) {
auto it = plugins.find(plugin);
@@ -208,12 +216,6 @@ namespace loot {
plugins.erase(it);
return;
}
-
- it = find(regexPlugins.begin(), regexPlugins.end(), plugin);
-
- if (it != regexPlugins.end()) {
- regexPlugins.erase(it);
- }
}
// Masterlist member functions
diff --git a/src/backend/game.h b/src/backend/game.h
index 9d282fcf..f32e9bbc 100644
--- a/src/backend/game.h
+++ b/src/backend/game.h
@@ -20,7 +20,7 @@
You should have received a copy of the GNU General Public License
along with LOOT. If not, see