Warn about unsatisfied dependencies
authorPerttu Ahola <celeron55@gmail.com>
Sun, 27 Nov 2011 11:03:54 +0000 (13:03 +0200)
committerPerttu Ahola <celeron55@gmail.com>
Tue, 29 Nov 2011 17:13:55 +0000 (19:13 +0200)
src/server.cpp

index 58611bed1558738998a6246e3d0073598ebd6880..f3e497ff171cf7229e6ab36259b37cf0448b51f3 100644 (file)
@@ -979,6 +979,7 @@ static core::list<ModSpec> getMods(core::list<std::string> &modspaths)
                                mods_satisfied.push(spec);
                }
        }
+       // Sort by depencencies
        while(!mods_satisfied.empty()){
                ModSpec mod = mods_satisfied.front();
                mods_satisfied.pop();
@@ -994,6 +995,22 @@ static core::list<ModSpec> getMods(core::list<std::string> &modspaths)
                        mods_satisfied.push(mod2);
                }
        }
+       // Check unsatisfied dependencies
+       for(core::list<ModSpec>::Iterator i = mods_unsorted.begin();
+                       i != mods_unsorted.end(); i++){
+               ModSpec mod = *i;
+               if(mod.unsatisfied_depends.empty())
+                       continue;
+               errorstream<<"mod \""<<mod.name
+                               <<"\" has unsatisfied dependencies:";
+               for(std::set<std::string>::iterator
+                               i = mod.unsatisfied_depends.begin();
+                               i != mod.unsatisfied_depends.end(); i++){
+                       errorstream<<" \""<<(*i)<<"\"";
+               }
+               errorstream<<". Loading nevertheless."<<std::endl;
+               mods_sorted.push_back(mod);
+       }
        return mods_sorted;
 }