From 0838e25d15a02189252e2ae1c822db0bbb63c5fb Mon Sep 17 00:00:00 2001 From: WrinklyNinja Date: Mon, 12 May 2014 18:03:11 +0100 Subject: [PATCH] Invalid install message type change. Master/requirement/incompatibility error messages become warnings if the plugin in question is inactive. --- src/backend/metadata.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/backend/metadata.cpp b/src/backend/metadata.cpp index 4ffecd1e..c18c9a6e 100644 --- a/src/backend/metadata.cpp +++ b/src/backend/metadata.cpp @@ -723,28 +723,33 @@ namespace loot { } void Plugin::CheckInstallValidity(const Game& game) { + unsigned int messageType; + if (game.IsActive(name)) + messageType = loot::Message::error; + else + messageType = loot::Message::warn; if (tags.find(Tag("Filter")) == tags.end()) { for (vector::const_iterator it=masters.begin(), endIt=masters.end(); it != endIt; ++it) { if (!boost::filesystem::exists(game.DataPath() / *it) && !boost::filesystem::exists(game.DataPath() / (*it + ".ghost"))) { BOOST_LOG_TRIVIAL(error) << "\"" << name << "\" requires \"" << *it << "\", but it is missing."; - messages.push_back(loot::Message(loot::Message::error, (boost::format(boost::locale::translate("This plugin requires \"%1%\" to be installed, but it is missing.")) % *it).str())); + messages.push_back(loot::Message(messageType, (boost::format(boost::locale::translate("This plugin requires \"%1%\" to be installed, but it is missing.")) % *it).str())); } - else if (!game.IsActive(*it) && game.IsActive(name)) { + else if (!game.IsActive(*it)) { BOOST_LOG_TRIVIAL(error) << "\"" << name << "\" requires \"" << *it << "\", but it is inactive."; - messages.push_back(loot::Message(loot::Message::error, (boost::format(boost::locale::translate("This plugin requires \"%1%\" to be active, but it is inactive.")) % *it).str())); + messages.push_back(loot::Message(messageType, (boost::format(boost::locale::translate("This plugin requires \"%1%\" to be active, but it is inactive.")) % *it).str())); } } } for (set::const_iterator it=requirements.begin(), endIt=requirements.end(); it != endIt; ++it) { if (!boost::filesystem::exists(game.DataPath() / it->Name()) && !(IsPlugin(it->Name()) && boost::filesystem::exists(game.DataPath() / (it->Name() + ".ghost")))) { BOOST_LOG_TRIVIAL(error) << "\"" << name << "\" requires \"" << it->Name() << "\", but it is missing."; - messages.push_back(loot::Message(loot::Message::error, (boost::format(boost::locale::translate("This plugin requires \"%1%\" to be installed, but it is missing.")) % it->Name()).str())); + messages.push_back(loot::Message(messageType, (boost::format(boost::locale::translate("This plugin requires \"%1%\" to be installed, but it is missing.")) % it->Name()).str())); } } for (set::const_iterator it=incompatibilities.begin(), endIt=incompatibilities.end(); it != endIt; ++it) { if (boost::filesystem::exists(game.DataPath() / it->Name()) || (IsPlugin(it->Name()) && boost::filesystem::exists(game.DataPath() / (it->Name() + ".ghost")))) { BOOST_LOG_TRIVIAL(error) << "\"" << name << "\" is incompatible with \"" << it->Name() << "\", but both are present."; - messages.push_back(loot::Message(loot::Message::error, (boost::format(boost::locale::translate("This plugin is incompatible with \"%1%\", but both are present.")) % it->Name()).str())); + messages.push_back(loot::Message(messageType, (boost::format(boost::locale::translate("This plugin is incompatible with \"%1%\", but both are present.")) % it->Name()).str())); } } }