From 8fe5ef5561db7fc02255a55ece2235ea625abc03 Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Tue, 12 Apr 2016 18:36:02 +0100 Subject: [PATCH] Silently apply unchanged TES5 & FO4 sorted load orders This fixes #562, in which plugins which weren't listed in loadorder.txt/plugins.txt were not having their inferred load order positions made explicit, which could cause confusion if another utility or the game inferred a different load order for them. --- src/gui/handler.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/gui/handler.cpp b/src/gui/handler.cpp index a261d85b..a427e425 100644 --- a/src/gui/handler.cpp +++ b/src/gui/handler.cpp @@ -912,6 +912,23 @@ namespace loot { PluginSorter sorter; list plugins = sorter.Sort(_lootState.CurrentGame(), _lootState.getLanguage().Code()); + // If TESV or FO4, check if load order has been changed. + if ((_lootState.CurrentGame().Id() == Game::tes5 || _lootState.CurrentGame().Id() == Game::fo4) + && equal(begin(plugins), end(plugins), begin(_lootState.CurrentGame().GetLoadOrder()))) { + // Load order has not been changed, set it without asking for + // user input because there are no changes to accept and some + // plugins' positions may only be inferred and not written to + // loadorder.txt/plugins.txt. + std::list newLoadOrder; + std::transform(begin(plugins), + end(plugins), + back_inserter(newLoadOrder), + [](const Plugin& plugin) { + return plugin.Name(); + }); + _lootState.CurrentGame().SetLoadOrder(newLoadOrder); + } + YAML::Node node; // Store global messages in case they have changed.