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:
WrinklyNinja
2013-10-11 23:13:18 +01:00
parent 89e84e9537
commit 1f31d62174
2 changed files with 21 additions and 1 deletions
+17
View File
@@ -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
View File
@@ -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;
}