+ModConfiguration::ModConfiguration(std::string worldpath)
+{
+ // Add all world mods and all game mods
+ addModsInPath(worldpath + DIR_DELIM + "worldmods");
+ SubgameSpec gamespec = findWorldSubgame(worldpath);
+ addModsInPath(gamespec.gamemods_path);
+
+ // check world.mt file for mods explicitely declared to be
+ // loaded or not by a load_mod_<modname> = ... line.
+ std::string worldmt = worldpath+DIR_DELIM+"world.mt";
+ Settings worldmt_settings;
+ worldmt_settings.readConfigFile(worldmt.c_str());
+ std::vector<std::string> names = worldmt_settings.getNames();
+ std::set<std::string> exclude_mod_names;
+ for(std::vector<std::string>::iterator it = names.begin();
+ it != names.end(); ++it)
+ {
+ std::string name = *it;
+ // for backwards compatibility: exclude only mods which are
+ // explicitely excluded. if mod is not mentioned at all, it is
+ // enabled. So by default, all installed mods are enabled.
+ if (name.compare(0,9,"load_mod_") == 0 &&
+ !worldmt_settings.getBool(name))
+ {
+ exclude_mod_names.insert(name.substr(9));
+ }
+ }