If a plugin's masters are all present, this makes the sorting logic for
Morrowind match the other supported games. If a plugin's masters are
missing, use the plugin's total record count as the override record
count.
Plugins with missing masters cannot be loaded by the game, reducing the
impact (if any) of the probably-inflated record counts. It's better for
LOOT to be able to sort a slightly wonky load order if there are missing
masters than for it to fail completely, as such plugins may be present
for development and testing reasons.
It was doing case-sensitive load order position lookup, and redoing it
for each pair of plugins. Now case sensitivity is handled correctly and
positions are cached.
boost::locale::to_lower uses locale-dependent lowercasing, which doesn't
match filesystem case insensitivity when running in the Turkish locale,
as then lowercase "I" is not "i", and uppercase "i" is not "I". To avoid
this issue on Windows, use CompareStringOrdinal to use the same rules
as the filesystem when comparing strings, and CharUpperBuffW to
uppercase strings before comparing hashes. It's less clear that
CharUpperBuffW uses the same rules as the filesystem, but that's what I
understand from reading around.
I haven't figured out how to get similar behaviour on Linux, though it
probably involves using ICU. For now, boost::locale::to_upper is used
before comparison. This is inaccurate, but at least avoids the problem
of some characters not round-tripping when lowercased.