From c6b84ff644a0402e0a03692eaa65232cb03f3a9a Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Thu, 16 Jul 2015 17:42:52 +0100 Subject: [PATCH] Don't store metadata list parsing errors internally. It doesn't really matter for the masterlist, but if the userlist is edited and saved, the parsing error will be recorded and so displayed on every load, even if it's no longer true. --- src/gui/handler.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/gui/handler.cpp b/src/gui/handler.cpp index 1a4ff311..ef353e80 100644 --- a/src/gui/handler.cpp +++ b/src/gui/handler.cpp @@ -656,6 +656,7 @@ namespace loot { installed.push_back(pos->second); } + list parsingErrors; if (isFirstLoad) { //Parse masterlist, don't update it. if (fs::exists(_lootState.CurrentGame().MasterlistPath())) { @@ -665,7 +666,7 @@ namespace loot { _lootState.CurrentGame().masterlist.Load(_lootState.CurrentGame().MasterlistPath()); } catch (exception &e) { - _lootState.CurrentGame().masterlist.messages.push_back(Message(Message::error, (boost::format(loc::translate("An error occurred while parsing the masterlist: %1%")) % e.what()).str())); + parsingErrors.push_back(Message(Message::error, (boost::format(loc::translate("An error occurred while parsing the masterlist: %1%")) % e.what()).str())); } } @@ -677,7 +678,7 @@ namespace loot { _lootState.CurrentGame().userlist.Load(_lootState.CurrentGame().UserlistPath()); } catch (exception &e) { - _lootState.CurrentGame().userlist.messages.push_back(Message(Message::error, (boost::format(loc::translate("An error occurred while parsing the userlist: %1%")) % e.what()).str())); + parsingErrors.push_back(Message(Message::error, (boost::format(loc::translate("An error occurred while parsing the userlist: %1%")) % e.what()).str())); } } } @@ -779,8 +780,13 @@ namespace loot { //Evaluate any conditions in the global messages. BOOST_LOG_TRIVIAL(debug) << "Evaluating global message conditions."; - list messages = _lootState.CurrentGame().masterlist.messages; - messages.insert(messages.end(), _lootState.CurrentGame().userlist.messages.begin(), _lootState.CurrentGame().userlist.messages.end()); + list messages = parsingErrors; + messages.insert(messages.end(), + _lootState.CurrentGame().masterlist.messages.begin(), + _lootState.CurrentGame().masterlist.messages.end()); + messages.insert(messages.end(), + _lootState.CurrentGame().userlist.messages.begin(), + _lootState.CurrentGame().userlist.messages.end()); try { list::iterator it = messages.begin(); while (it != messages.end()) {