From dcd0b63f645bccf497a030b6b1cec97178542eb1 Mon Sep 17 00:00:00 2001 From: PilzAdam Date: Sun, 19 May 2013 19:46:50 +0200 Subject: Dont load mods that have no entry in world.mt --- src/mods.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/mods.cpp') diff --git a/src/mods.cpp b/src/mods.cpp index 64c319992..a0a37afb9 100644 --- a/src/mods.cpp +++ b/src/mods.cpp @@ -220,7 +220,7 @@ ModConfiguration::ModConfiguration(std::string worldpath) Settings worldmt_settings; worldmt_settings.readConfigFile(worldmt.c_str()); std::vector names = worldmt_settings.getNames(); - std::set exclude_mod_names; + std::set include_mod_names; for(std::vector::iterator it = names.begin(); it != names.end(); ++it) { @@ -229,14 +229,13 @@ ModConfiguration::ModConfiguration(std::string worldpath) // 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)) + worldmt_settings.getBool(name)) { - exclude_mod_names.insert(name.substr(9)); + include_mod_names.insert(name.substr(9)); } } - // Collect all mods in gamespec.addon_mods_paths, - // excluding those in the set exclude_mod_names + // Collect all mods that are also in include_mod_names std::vector addon_mods; for(std::set::const_iterator it_path = gamespec.addon_mods_paths.begin(); it_path != gamespec.addon_mods_paths.end(); ++it_path) @@ -246,7 +245,7 @@ ModConfiguration::ModConfiguration(std::string worldpath) it != addon_mods_in_path.end(); ++it) { ModSpec& mod = *it; - if(exclude_mod_names.count(mod.name) == 0) + if(include_mod_names.count(mod.name) != 0) addon_mods.push_back(mod); } } -- cgit v1.2.3 From b2253e5b42aed74365cb6d10b90fea4a30dee5fa Mon Sep 17 00:00:00 2001 From: PilzAdam Date: Sun, 19 May 2013 19:52:29 +0200 Subject: Write mods that are not in world.mt into it at world startup --- src/mods.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/mods.cpp') diff --git a/src/mods.cpp b/src/mods.cpp index a0a37afb9..9097f5708 100644 --- a/src/mods.cpp +++ b/src/mods.cpp @@ -247,8 +247,11 @@ ModConfiguration::ModConfiguration(std::string worldpath) ModSpec& mod = *it; if(include_mod_names.count(mod.name) != 0) addon_mods.push_back(mod); + else + worldmt_settings.setBool("load_mod_" + mod.name, false); } } + worldmt_settings.updateConfigFile(worldmt.c_str()); addMods(addon_mods); -- cgit v1.2.3 From 4a9fe1a1d5d19565bca67c0dcb3dbf43bd06f278 Mon Sep 17 00:00:00 2001 From: Kahrl Date: Tue, 21 May 2013 14:56:43 +0200 Subject: Log non-fatal mod name conflict to actionstream instead of errorstream --- src/mods.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mods.cpp') diff --git a/src/mods.cpp b/src/mods.cpp index 9097f5708..9bcf73aa7 100644 --- a/src/mods.cpp +++ b/src/mods.cpp @@ -309,7 +309,7 @@ void ModConfiguration::addMods(std::vector new_mods) // BAD CASE: name conflict in different levels. u32 oldindex = existing_mods[mod.name]; const ModSpec &oldmod = m_unsatisfied_mods[oldindex]; - errorstream<<"WARNING: Mod name conflict detected: \"" + actionstream<<"WARNING: Mod name conflict detected: \"" <