mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-26 08:41:13 +02:00
Some tweaks for mod loading. Still doesn't work.
This commit is contained in:
parent
abd4a96bf1
commit
20b54a39b6
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user