1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-19 00:17:56 +02:00

- Fixed some warnings from cppcheck

- Minor improvements to JSON validation
- Cleanup in SDL_Extensions.cpp
- Implemented new propery for creature format: idle animation duration
- Disabled idle animation of some of conflux creatures (was clearly
broken)
This commit is contained in:
Ivan Savenko
2013-11-06 13:42:58 +00:00
parent 86b7feeab3
commit 71d6b0fea9
24 changed files with 159 additions and 183 deletions

View File

@ -265,7 +265,7 @@ void CContentHandler::ContentTypeHandler::loadMod(std::string modName)
continue;
}
}
// normal new object
// normal new object or one with index bigger that data size
JsonUtils::validate(data, "vcmi:" + objectName, name);
handler->loadObject(modName, name, data);
}
@ -533,22 +533,6 @@ CModInfo & CModHandler::getModData(TModID modId)
assert(vstd::contains(activeMods, modId)); // not really necessary but won't hurt
return mod;
}
template<typename Handler>
void CModHandler::handleData(Handler handler, const JsonNode & source, std::string listName, std::string schemaName)
{
JsonNode config = JsonUtils::assembleFromFiles(source[listName].convertTo<std::vector<std::string> >());
for(auto & entry : config.Struct())
{
if (!entry.second.isNull()) // may happens if mod removed object by setting json entry to null
{
JsonUtils::validate(entry.second, schemaName, entry.first);
handler->load(entry.first, entry.second);
}
}
}
void CModHandler::beforeLoad()
{
loadConfigFromFile("defaultMods.json");