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:
@ -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]));
|
||||
}
|
||||
|
Reference in New Issue
Block a user