Created
September 4, 2015 05:17
-
-
Save sofar/ecc412c00903bca43405 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/mods.cpp b/src/mods.cpp | |
index f5174ac..a8874fa 100644 | |
--- a/src/mods.cpp | |
+++ b/src/mods.cpp | |
@@ -85,15 +85,12 @@ void parseModContents(ModSpec &spec) | |
} | |
} | |
-std::map<std::string, ModSpec> getModsInPath(std::string path, bool part_of_modpack, const std::string &worldpath) | |
+std::map<std::string, ModSpec> getModsInPath(std::string path, bool part_of_modpack, const Settings &worldmt_settings) | |
{ | |
// NOTE: this function works in mutual recursion with parseModContents | |
std::map<std::string, ModSpec> result; | |
std::vector<fs::DirListNode> dirlist = fs::GetDirListing(path); | |
- std::string worldmt = worldpath+DIR_DELIM+"world.mt"; | |
- Settings worldmt_settings; | |
- worldmt_settings.readConfigFile(worldmt.c_str()); | |
for(u32 j=0; j<dirlist.size(); j++){ | |
if(!dirlist[j].dir) | |
continue; | |
@@ -169,10 +166,13 @@ std::vector<ModSpec> flattenMods(std::map<std::string, ModSpec> mods) | |
ModConfiguration::ModConfiguration(std::string worldpath) | |
{ | |
SubgameSpec gamespec = findWorldSubgame(worldpath); | |
+ std::string worldmt = worldpath+DIR_DELIM+"world.mt"; | |
+ Settings worldmt_settings; | |
+ worldmt_settings.readConfigFile(worldmt.c_str()); | |
// Add all game mods and all world mods | |
- addModsInPath(gamespec.gamemods_path, worldpath); | |
- addModsInPath(worldpath + DIR_DELIM + "worldmods", worldpath); | |
+ addModsInPath(gamespec.gamemods_path, worldmt_settings); | |
+ addModsInPath(worldpath + DIR_DELIM + "worldmods", worldmt_settings); | |
// check world.mt file for mods explicitely declared to be | |
// loaded or not by a load_mod_<modname> = ... line. | |
@@ -232,9 +232,9 @@ ModConfiguration::ModConfiguration(std::string worldpath) | |
resolveDependencies(); | |
} | |
-void ModConfiguration::addModsInPath(std::string path, const std::string &worldpath) | |
+void ModConfiguration::addModsInPath(std::string path, const Settings &worldmt_settings) | |
{ | |
- addMods(flattenMods(getModsInPath(path, false, worldpath))); | |
+ addMods(flattenMods(getModsInPath(path, false, worldmt_settings))); | |
} | |
void ModConfiguration::addMods(std::vector<ModSpec> new_mods) | |
diff --git a/src/mods.h b/src/mods.h | |
index c4aaea2..97b8d0d 100644 | |
--- a/src/mods.h | |
+++ b/src/mods.h | |
@@ -77,7 +77,9 @@ struct ModSpec | |
// Retrieves depends, optdepends, is_modpack and modpack_content | |
void parseModContents(ModSpec &mod); | |
-std::map<std::string,ModSpec> getModsInPath(std::string path, bool part_of_modpack = false, const std::string &worldpath = ""); | |
+std::map<std::string,ModSpec> getModsInPath(std::string path, | |
+ bool part_of_modpack = false, | |
+ const Settings &worldmt_settings); | |
// If failed, returned modspec has name=="" | |
ModSpec findCommonMod(const std::string &modname); | |
@@ -122,7 +124,7 @@ class ModConfiguration | |
private: | |
// adds all mods in the given path. used for games, modpacks | |
// and world-specific mods (worldmods-folders) | |
- void addModsInPath(std::string path, const std::string &worldpath); | |
+ void addModsInPath(std::string path, const Settings &worldmt_settings); | |
// adds all mods in the set. | |
void addMods(std::vector<ModSpec> new_mods); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment