diff --git a/src/backend/legacy-parser.h b/src/backend/legacy-parser.h index 469266d7..419872b0 100644 --- a/src/backend/legacy-parser.h +++ b/src/backend/legacy-parser.h @@ -501,11 +501,6 @@ namespace boss { std::list::iterator it = messages.begin(); while (it != messages.end()) { - std::string condition = it->Condition(); - ConvertCondition(condition); - - *it = Message(it->Type(), it->Content(), condition); - if (it->Type() == g_message_tag) { std::string message = it->ChooseContent(g_lang_any).Str(); @@ -684,6 +679,8 @@ namespace boss { std::vector mc_vec; mc_vec.push_back(MessageContent(content, langInt)); + ConvertCondition(condition); + message = Message(type, mc_vec, condition); } diff --git a/src/backend/metadata.cpp b/src/backend/metadata.cpp index 1c7af0cf..9e0adcd5 100644 --- a/src/backend/metadata.cpp +++ b/src/backend/metadata.cpp @@ -30,6 +30,7 @@ #include #include #include +#include using namespace std; @@ -83,6 +84,8 @@ namespace boss { } bool ConditionStruct::EvalCondition(boss::Game& game) const { + BOOST_LOG_TRIVIAL(trace) << "Evaluating condition: " << _condition; + if (_condition.empty()) return true; @@ -153,6 +156,10 @@ namespace boss { } bool Message::EvalCondition(boss::Game& game, const unsigned int language) { + + BOOST_LOG_TRIVIAL(trace) << "Choosing message language."; + + if (_content.size() > 1) { if (language == g_lang_any) //Can use a message of any language, so use the first string. _content.resize(1); diff --git a/src/backend/parsers.h b/src/backend/parsers.h index cc27ab6c..8f23d3a8 100644 --- a/src/backend/parsers.h +++ b/src/backend/parsers.h @@ -570,6 +570,9 @@ namespace boss { //Checks that the path (not regex) doesn't go outside any game folders. bool IsSafePath(const std::string& path) { + + BOOST_LOG_TRIVIAL(trace) << "Checking to see if the path \"" << path << "\" is safe."; + std::vector components; boost::split(components, path, boost::is_any_of("/\\")); components.pop_back(); diff --git a/src/gui/main.cpp b/src/gui/main.cpp index 2ab3c628..9790efb9 100644 --- a/src/gui/main.cpp +++ b/src/gui/main.cpp @@ -75,12 +75,12 @@ namespace loc = boost::locale; struct plugin_loader { plugin_loader(boss::Plugin& plugin, boss::Game& game) : _plugin(plugin), _game(game) { - BOOST_LOG_TRIVIAL(info) << "Creating loader for: " << plugin.Name(); } void operator () () { BOOST_LOG_TRIVIAL(info) << "Loading: " << _plugin.Name(); _plugin = boss::Plugin(_game, _plugin.Name(), false); + BOOST_LOG_TRIVIAL(info) << "Finished loading: " << _plugin.Name(); } boss::Plugin& _plugin; @@ -95,6 +95,7 @@ struct plugin_list_loader { if (skipPlugins.find(it->Name()) == skipPlugins.end()) { BOOST_LOG_TRIVIAL(info) << "Loading: " << it->Name(); *it = boss::Plugin(_game, it->Name(), false); + BOOST_LOG_TRIVIAL(info) << "Finished loading: " << it->Name(); } } } @@ -524,12 +525,17 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) { //Evaluate any conditions in the global messages. BOOST_LOG_TRIVIAL(trace) << "Evaluating global message conditions..."; - list::iterator it=messages.begin(); - while (it != messages.end()) { - if (!it->EvalCondition(_game, lang)) - it = messages.erase(it); - else - ++it; + try { + list::iterator it=messages.begin(); + while (it != messages.end()) { + if (!it->EvalCondition(_game, lang)) + it = messages.erase(it); + else + ++it; + } + } catch (boss::error& e) { + BOOST_LOG_TRIVIAL(error) << "A global message contains a condition that could not be evaluated. Details: " << e.what(); + messages.push_back(boss::Message(boss::g_message_error, (format(loc::translate("A global message contains a condition that could not be evaluated. Details: %1%")) % e.what()).str())); } //Merge plugin list, masterlist and userlist plugin data.