|
@@ -1,7 +1,7 @@
|
|
|
#include "StdInc.h"
|
|
|
#include "CModHandler.h"
|
|
|
#include "JsonNode.h"
|
|
|
-
|
|
|
+#include "Filesystem\CResourceLoader.h" //TODO: reorganize
|
|
|
/*
|
|
|
* CModHandler.h, part of VCMI engine
|
|
|
*
|
|
@@ -65,23 +65,22 @@ void CModHandler::loadConfigFromFile (std::string name)
|
|
|
|
|
|
//auto mods = config["activeMods"]; //TODO: load only mods from the list
|
|
|
|
|
|
- CResourceLoader * modLoader = new CResourceLoader;
|
|
|
+ auto resourceLoader = CResourceHandler::get();
|
|
|
+ auto iterator = resourceLoader->getIterator([](const ResourceID & ident) -> bool
|
|
|
+ {
|
|
|
+ std::string name = ident.getName();
|
|
|
|
|
|
- auto iterator = modLoader->getIterator([](const ResourceID & ident) -> bool
|
|
|
- {
|
|
|
- std::string name = ident.getName();
|
|
|
-
|
|
|
- return ident.getType() == EResType::TEXT
|
|
|
- && std::count(name.begin(), name.end(), '/') == 3
|
|
|
- && boost::algorithm::starts_with(name, "ALL/MODS/")
|
|
|
- && boost::algorithm::ends_with(name, "MOD"); //all mods have "mod.json" name - does it make sense?
|
|
|
+ return ident.getType() == EResType::TEXT
|
|
|
+ && std::count(name.begin(), name.end(), '/') == 3
|
|
|
+ && boost::algorithm::starts_with(name, "ALL/MODS/")
|
|
|
+ && boost::algorithm::ends_with(name, "MOD"); //all mods have "mod.json" name - does it make sense?
|
|
|
});
|
|
|
|
|
|
- std::set<std::string> foundMods;
|
|
|
- while (iterator.hasNext())
|
|
|
- {
|
|
|
- foundMods.insert(iterator->getName());
|
|
|
- ++iterator;
|
|
|
+ std::set<std::string> foundMods;
|
|
|
+ while (iterator.hasNext())
|
|
|
+ {
|
|
|
+ foundMods.insert(iterator->getName());
|
|
|
+ ++iterator;
|
|
|
}
|
|
|
|
|
|
BOOST_FOREACH (auto mod, foundMods)
|