Skip to content

Commit dcd0b63

Browse files
committedMay 19, 2013
Dont load mods that have no entry in world.mt
1 parent b2577b1 commit dcd0b63

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed
 

‎src/mods.cpp

+5-6
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ ModConfiguration::ModConfiguration(std::string worldpath)
220220
Settings worldmt_settings;
221221
worldmt_settings.readConfigFile(worldmt.c_str());
222222
std::vector<std::string> names = worldmt_settings.getNames();
223-
std::set<std::string> exclude_mod_names;
223+
std::set<std::string> include_mod_names;
224224
for(std::vector<std::string>::iterator it = names.begin();
225225
it != names.end(); ++it)
226226
{
@@ -229,14 +229,13 @@ ModConfiguration::ModConfiguration(std::string worldpath)
229229
// explicitely excluded. if mod is not mentioned at all, it is
230230
// enabled. So by default, all installed mods are enabled.
231231
if (name.compare(0,9,"load_mod_") == 0 &&
232-
!worldmt_settings.getBool(name))
232+
worldmt_settings.getBool(name))
233233
{
234-
exclude_mod_names.insert(name.substr(9));
234+
include_mod_names.insert(name.substr(9));
235235
}
236236
}
237237

238-
// Collect all mods in gamespec.addon_mods_paths,
239-
// excluding those in the set exclude_mod_names
238+
// Collect all mods that are also in include_mod_names
240239
std::vector<ModSpec> addon_mods;
241240
for(std::set<std::string>::const_iterator it_path = gamespec.addon_mods_paths.begin();
242241
it_path != gamespec.addon_mods_paths.end(); ++it_path)
@@ -246,7 +245,7 @@ ModConfiguration::ModConfiguration(std::string worldpath)
246245
it != addon_mods_in_path.end(); ++it)
247246
{
248247
ModSpec& mod = *it;
249-
if(exclude_mod_names.count(mod.name) == 0)
248+
if(include_mod_names.count(mod.name) != 0)
250249
addon_mods.push_back(mod);
251250
}
252251
}

‎src/server.cpp

+2-8
Original file line numberDiff line numberDiff line change
@@ -727,19 +727,13 @@ Server::Server(
727727
std::string worldmt = m_path_world + DIR_DELIM + "world.mt";
728728
worldmt_settings.readConfigFile(worldmt.c_str());
729729
std::vector<std::string> names = worldmt_settings.getNames();
730-
std::set<std::string> exclude_mod_names;
731730
std::set<std::string> load_mod_names;
732731
for(std::vector<std::string>::iterator it = names.begin();
733732
it != names.end(); ++it)
734733
{
735734
std::string name = *it;
736-
if (name.compare(0,9,"load_mod_")==0)
737-
{
738-
if(worldmt_settings.getBool(name))
739-
load_mod_names.insert(name.substr(9));
740-
else
741-
exclude_mod_names.insert(name.substr(9));
742-
}
735+
if(name.compare(0,9,"load_mod_")==0 && worldmt_settings.getBool(name))
736+
load_mod_names.insert(name.substr(9));
743737
}
744738
// complain about mods declared to be loaded, but not found
745739
for(std::vector<ModSpec>::iterator it = m_mods.begin();

0 commit comments

Comments
 (0)
Please sign in to comment.