Revert back to using lexicographical vertex order

For vertices in the plugin graph. This is so that the group and overlap
edges are evaluated in an order that does not depend on the current load
order. Tie-breaking still uses the current load order.

This is necessary because if the group and overlap edges that get added
depend on the current load order, sorting and applying changes the
current load order, so sorting again may give different results even
even though no plugin data or metadata has changed.
This commit is contained in:
Oliver Hamlet
2023-01-09 19:00:41 +00:00
parent 53e2dbba1f
commit 58df21f11c
6 changed files with 180 additions and 88 deletions
+11
View File
@@ -2,6 +2,17 @@
Version History
***************
0.19.1 - Unreleased
===================
Fixed
-----
- Sorting and applying and then sorting again will no longer give a different
result for the second sort. libloot v0.19.0 changed the order in which group
and overlap edges were processed to be the current load order: it has now
reverted back to the lexicographical order of plugin filenames.
0.19.0 - 2023-01-07
===================
+15 -15
View File
@@ -21,17 +21,7 @@ in the masterlist and userlist.
Create plugin graph vertices
============================
Once the plugins have been loaded, they are sorted into their current load
order:
* If both plugins have positions in the current load order, the function
preserves their existing relative order.
* If one plugin has a position and the other does not, the plugin with a
position goes before the plugin without a position.
* If neither plugin has a load order position, a case-insensitive
lexicographical comparison of their filenames without file extensions is used
to decide their order. If they are equal, a case-insensitive lexicographical
comparison of their file extensions is used.
Once the plugins have been loaded, they are sorted into lexicographical order.
After that, two graphs are created, and the plugins are added to them as
vertices in their sorted order. Plugins that have their master flag set go in
@@ -127,10 +117,20 @@ Tie-break edges
---------------
Finally, tie-break edges are added to ensure that sorting is consistent. The
graph's vertices are iterated over in their insertion order (i.e. the current
load order). Each loop looks at the current vertex and the next one following it
(e.g. the first iteration is for vertices 0 and 1, the second is for 1 and 2,
etc.).
graph's vertices are sorted into their current load order:
* If both plugins have positions in the current load order, the function
preserves their existing relative order.
* If one plugin has a position and the other does not, the plugin with a
position goes before the plugin without a position.
* If neither plugin has a load order position, a case-insensitive
lexicographical comparison of their filenames without file extensions is used
to decide their order. If they are equal, a case-insensitive lexicographical
comparison of their file extensions is used.
Once sorted, they are iterated over. Each loop looks at the current vertex and
the next one following it (e.g. the first iteration is for vertices 0 and 1, the
second is for 1 and 2, etc.).
For each (``current``, ``next``) pair of vertices, try to find a path from
``next`` to ``current``.