diff --git a/src/backend/metadata.cpp b/src/backend/metadata.cpp index 41e9c3f4..8e79fe81 100644 --- a/src/backend/metadata.cpp +++ b/src/backend/metadata.cpp @@ -699,23 +699,33 @@ namespace boss { return false; } - std::map Plugin::CheckInstallValidity(const Game& game) const { - map issues; + std::vector Plugin::CheckInstallValidity(const Game& game) const { + std::vector errorMessages; 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"))) - issues.insert(pair(*it,false)); + 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."; + errorMessages.push_back((boost::format(boost::locale::translate("This plugin requires \"%1%\" to be installed, but it is missing.")) % *it).str()); + } + else if (!game.IsActive(*it)) { + BOOST_LOG_TRIVIAL(error) << "\"" << name << "\" requires \"" << *it << "\", but it is inactive."; + errorMessages.push_back((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")))) - issues.insert(pair(it->DisplayName(),false)); + 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."; + errorMessages.push_back((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")))) - issues.insert(pair(it->DisplayName(),true)); + 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."; + errorMessages.push_back((boost::format(boost::locale::translate("This plugin is incompatible with \"%1%\", but both are present.")) % it->Name()).str()); + } } - return issues; + return errorMessages; } bool Plugin::LoadsBSA(const Game& game) const { diff --git a/src/backend/metadata.h b/src/backend/metadata.h index 992476ea..0b968503 100644 --- a/src/backend/metadata.h +++ b/src/backend/metadata.h @@ -210,7 +210,7 @@ namespace boss { bool MustLoadAfter(const Plugin& plugin) const; //Checks masters, reqs and loadAfter. //Validity checks. - std::map CheckInstallValidity(const Game& game) const; //Checks that reqs and masters are all present, and that no incs are present. Returns a map of filenames and whether they are missing (if bool is true, then filename is a req or master, otherwise it's an inc). + std::vector CheckInstallValidity(const Game& game) const; //Checks that reqs and masters are all present, and that no incs are present. Returns a map of filenames and whether they are missing (if bool is true, then filename is a req or master, otherwise it's an inc). private: std::string name; bool enabled; //Default to true. diff --git a/src/gui/main.cpp b/src/gui/main.cpp index 58091932..11f25b0c 100644 --- a/src/gui/main.cpp +++ b/src/gui/main.cpp @@ -738,16 +738,10 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) { //Also check install validity. BOOST_LOG_TRIVIAL(trace) << "Checking that the current install is valid according to this plugin's data."; - map issues = graph[*vit].CheckInstallValidity(_game); + vector issues = graph[*vit].CheckInstallValidity(_game); list pluginMessages = graph[*vit].Messages(); - for (map::const_iterator jt=issues.begin(), endJt=issues.end(); jt != endJt; ++jt) { - if (jt->second) { - BOOST_LOG_TRIVIAL(error) << "\"" << jt->first << "\" is incompatible with \"" << graph[*vit].Name() << "\" and is present."; - pluginMessages.push_back(boss::Message(boss::g_message_error, (format(loc::translate("\"%1%\" is incompatible with \"%2%\" and is present.")) % jt->first % graph[*vit].Name()).str())); - } else { - BOOST_LOG_TRIVIAL(error) << "\"" << jt->first << "\" is required by \"" << graph[*vit].Name() << "\" but is missing."; - pluginMessages.push_back(boss::Message(boss::g_message_error, (format(loc::translate("\"%1%\" is required by \"%2%\" but is missing.")) % jt->first % graph[*vit].Name()).str())); - } + for (vector::const_iterator jt = issues.begin(), jtend = issues.end(); jt != jtend; ++jt) { + pluginMessages.push_back(boss::Message(boss::g_message_error, *jt)); } if (!issues.empty()) graph[*vit].Messages(pluginMessages);