1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

Data for campaign win/loss conditions. All campaigns should now have

correct conditions.
All custom conditions are now validated using schema.

Note that some of scenarios may not work due to instant win/loss, mostly
because some placeholders fail to import (Mantis #1643)
This commit is contained in:
Ivan Savenko
2014-01-01 13:30:31 +00:00
parent aff704d1ca
commit cd8a0c01e4
3 changed files with 1736 additions and 1 deletions

View File

@ -86,10 +86,22 @@ std::unique_ptr<IMapLoader> CMapService::getMapLoader(std::unique_ptr<CInputStre
}
}
static JsonNode loadPatches(std::string path)
{
JsonNode node = JsonUtils::assembleFromFiles(path);
for (auto & entry : node.Struct())
JsonUtils::validate(entry.second, "vcmi:mapHeader", "patch for " + entry.first);
return node;
}
std::unique_ptr<IMapPatcher> CMapService::getMapPatcher(std::string scenarioName)
{
static JsonNode node;
if (node.isNull())
node = loadPatches("config/mapOverrides.json");
boost::to_lower(scenarioName);
logGlobal->debugStream() << "Request to patch map " << scenarioName;
JsonNode node = JsonUtils::assembleFromFiles("config/mapOverrides.json");
return std::unique_ptr<IMapPatcher>(new CMapLoaderJson(node[scenarioName]));
}