Merge pull request #500 from doserj/server_report_missing_deps

Print missing mod dependencies on server start
This commit is contained in:
celeron55 2013-02-20 11:34:57 -08:00
commit b29834ab02

@ -998,17 +998,20 @@ Server::Server(
ModConfiguration modconf(m_path_world); ModConfiguration modconf(m_path_world);
m_mods = modconf.getMods(); m_mods = modconf.getMods();
std::list<ModSpec> unsatisfied_mods = modconf.getUnsatisfiedMods();
// complain about mods with unsatisfied dependencies // complain about mods with unsatisfied dependencies
if(!modconf.isConsistent()) if(!modconf.isConsistent())
{ {
errorstream << "The following mods have unsatisfied dependencies: "; for(std::list<ModSpec>::iterator it = unsatisfied_mods.begin();
std::list<ModSpec> modlist = modconf.getUnsatisfiedMods(); it != unsatisfied_mods.end(); ++it)
for(std::list<ModSpec>::iterator it = modlist.begin();
it != modlist.end(); ++it)
{ {
errorstream << (*it).name << " "; ModSpec mod = *it;
errorstream << "mod \"" << mod.name << "\" has unsatisfied dependencies: ";
for(std::set<std::string>::iterator dep_it = mod.unsatisfied_depends.begin();
dep_it != mod.unsatisfied_depends.end(); ++dep_it)
errorstream << " \"" << *dep_it << "\"";
errorstream << std::endl;
} }
errorstream << std::endl;
} }
Settings worldmt_settings; Settings worldmt_settings;
@ -1033,12 +1036,15 @@ Server::Server(
for(std::vector<ModSpec>::iterator it = m_mods.begin(); for(std::vector<ModSpec>::iterator it = m_mods.begin();
it != m_mods.end(); ++it) it != m_mods.end(); ++it)
load_mod_names.erase((*it).name); load_mod_names.erase((*it).name);
for(std::list<ModSpec>::iterator it = unsatisfied_mods.begin();
it != unsatisfied_mods.end(); ++it)
load_mod_names.erase((*it).name);
if(!load_mod_names.empty()) if(!load_mod_names.empty())
{ {
errorstream << "The following mods could not be found: "; errorstream << "The following mods could not be found:";
for(std::set<std::string>::iterator it = load_mod_names.begin(); for(std::set<std::string>::iterator it = load_mod_names.begin();
it != load_mod_names.end(); ++it) it != load_mod_names.end(); ++it)
errorstream << (*it) << " "; errorstream << " \"" << (*it) << "\"";
errorstream << std::endl; errorstream << std::endl;
} }