mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Masterlist converter skips some requirement messages.
Requirement messages that contain plugin filenames are reported by SilentSpike to overwhelmingly be for the plugin's masters, which just get removed anyway.
This commit is contained in:
@@ -50,6 +50,7 @@
|
||||
#include <boost/spirit/include/phoenix_stl.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/regex.hpp>
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
namespace boss {
|
||||
namespace qi = boost::spirit::qi;
|
||||
@@ -554,6 +555,22 @@ namespace boss {
|
||||
}
|
||||
|
||||
it = messages.erase(it);
|
||||
} else if (it->Type() == g_message_say) {
|
||||
std::string content = it->ChooseContent(g_lang_any).Str();
|
||||
unsigned int langInt = it->ChooseContent(g_lang_any).Language();
|
||||
std::string opener;
|
||||
if (langInt == g_lang_english || langInt == g_lang_any)
|
||||
opener = "Requires: ";
|
||||
else if (langInt == g_lang_spanish)
|
||||
opener = "Requiere: ";
|
||||
else if (langInt == g_lang_russian)
|
||||
opener = "Требуется: ";
|
||||
|
||||
if (boost::starts_with(content, opener) && (boost::icontains(content, ".esp") || boost::icontains(content, ".esm"))) {
|
||||
//Remove any requirement messages that contain a plugin filename, since it's probably a master, according to SilentSpike's experience.
|
||||
it = messages.erase(it);
|
||||
} else
|
||||
++it;
|
||||
} else
|
||||
++it;
|
||||
}
|
||||
|
||||
+4
-1
@@ -32,9 +32,12 @@ int main(int argc, char * argv[]) {
|
||||
boost::filesystem::path v2masterlist("masterlist.txt");
|
||||
list<boss::Plugin> test_plugins;
|
||||
list<boss::Message> globalMessages;
|
||||
|
||||
boost::log::core::get()->set_logging_enabled(false);
|
||||
|
||||
try {
|
||||
Loadv2Masterlist(v2masterlist, test_plugins, globalMessages);
|
||||
} catch (boss::error& e) {
|
||||
} catch (exception& e) {
|
||||
cout << "An error was encountered during masterlist parsing. Message: " << e.what() << endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user