mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Implemented global priority switch.
This commit is contained in:
@@ -297,7 +297,13 @@ nav: 0
|
||||
<tbody>
|
||||
<tr><td><code>name</code><td>string<td>✓<td>Can be an exact plugin filename or a regular expression plugin filename. If the period that precedes the file extension has been escaped (eg. <code>\.esp</code>, <code>\.esm</code>), the string is treated as a regular expression, otherwise it is treated as an exact filename.
|
||||
<tr><td><code>enabled</code><td>boolean<td>✗<td>Enables or disables use of the plugin object. Used for user rules, but no reason to use it in the masterlist. If unspecified, defaults to <code>true</code>.
|
||||
<tr><td><code>priority</code><td>integer<td>✗<td>Modifies plugin position relative to others that change one or more of the same records, but which are otherwise unrelated (ie. neither plugin lists the other as a master, requirement, or in its <code>after</code> list). An exception is made for plugins that contain only a header record: these plugins have their priorities compared against all unrelated plugins. A plugin with a higher priority value will load after a plugin with a lower priority value. Value can be anything in the range <code>-2000000000</code> to <code>2000000000</code>, and if unspecified defaults to <code>0</code>.
|
||||
<tr><td><code>priority</code><td>integer<td>✗<td>Modifies plugin position relative to others that change one or more of the same records, but which are otherwise unrelated (ie. neither plugin lists the other as a master, requirement, or in its <code>after</code> list). Plugins that don't change any of the same records are not compared, unless:
|
||||
<ul>
|
||||
<li>One of the plugins is a "dummy" plugin, containing only a header record.
|
||||
<li>One of the plugins has a priority greater than or equal to 1,000,000. In this case, only the modulo (ie. remainder when divided) with 1,000,000 is used when comparing plugin priority values &endash; the rest is only used to signify that the plugin should be compared against all others.
|
||||
</ul>
|
||||
<p>For example, <code>priority: 153000352</code> and <code>priority: 352</code> have equal values when compared, but a plugin with the first priority will be compared against all others, while a (non-dummy) plugin with the second priority will be compared against only those it conflicts with.
|
||||
<p>A plugin with a higher priority value will load after a plugin with a lower priority value. Value can be anything in the range <code>-2000000000</code> to <code>2000000000</code>, and if unspecified defaults to <code>0</code>.
|
||||
<tr><td><code>after</code><td>file list<td>✗<td>An unordered list of plugins that this plugin must load after, but which are not dependencies. Used for resolving specific compatibility issues and by user rules for specifying custom plugin positions.
|
||||
<tr><td><code>req</code><td>file list<td>✗<td>An unordered list of files that this plugin requires to be present. This plugin will load after any plugins listed. If any of these files are missing, an error message will be displayed. Intended for use specifying implicit dependencies, as LOOT will detect a plugin's explicit masters itself.
|
||||
<tr><td><code>inc</code><td>file list<td>✗<td>An unordered list of files that this plugin is incompatible with. If any of these files are present, an error message will be displayed.
|
||||
|
||||
+18
-2
@@ -188,14 +188,30 @@ namespace loot {
|
||||
loot::vertex_it vit2, vitend2;
|
||||
for (boost::tie(vit2, vitend2) = boost::vertices(graph); vit2 != vitend2; ++vit2) {
|
||||
|
||||
if (graph[*vit].Priority() == graph[*vit2].Priority() || (!graph[*vit].FormIDs().empty() && !graph[*vit2].FormIDs().empty() && !graph[*vit].DoFormIDsOverlap(graph[*vit2]))) {
|
||||
if (graph[*vit].Priority() == graph[*vit2].Priority()
|
||||
|| (graph[*vit].Priority() < 1000000 && graph[*vit2].Priority() < 1000000
|
||||
&& !graph[*vit].FormIDs().empty() && !graph[*vit2].FormIDs().empty() && !graph[*vit].DoFormIDsOverlap(graph[*vit2])
|
||||
)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
BOOST_LOG_TRIVIAL(trace) << "Checking priority difference between \"" << graph[*vit].Name() << "\" and \"" << graph[*vit2].Name() << "\".";
|
||||
|
||||
vertex_t vertex, parentVertex;
|
||||
if (graph[*vit].Priority() < graph[*vit2].Priority()) {
|
||||
//Modulo is not consistently defined for negative numbers, so figure it out explicitly.
|
||||
int p1 = graph[*vit].Priority();
|
||||
int p2 = graph[*vit2].Priority();
|
||||
if (p1 < 0)
|
||||
p1 = -((-p1) % 1000000);
|
||||
else
|
||||
p1 = p1 % 1000000;
|
||||
if (p2 < 0)
|
||||
p2 = -((-p2) % 1000000);
|
||||
else
|
||||
p2 = p2 % 1000000;
|
||||
|
||||
if (p1 < p2) {
|
||||
parentVertex = *vit;
|
||||
vertex = *vit2;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user