1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-13 01:20:34 +02:00

Improved json validation

- split JsonNode.cpp into JsonNode and JsonDetail files
- validation should be notably faster (at least 10% faster loading)
- support for "format" field, allows checking existance of files.
- minor fixes in schemas
- msk/msg files are now optional
This commit is contained in:
Ivan Savenko
2013-10-26 19:33:34 +00:00
parent e2c037402c
commit 9237e6d97d
17 changed files with 1313 additions and 1052 deletions

View File

@ -34,15 +34,26 @@ CGDefInfo::CGDefInfo()
void CGDefInfo::fetchInfoFromMSK()
{
ResourceID resID("SPRITES/" + name, EResType::MASK);
auto msk = CResourceHandler::get()->load(ResourceID(std::string("SPRITES/") + name, EResType::MASK))->readAll();
width = msk.first.get()[0];
height = msk.first.get()[1];
for(int i=0; i<6; ++i)
if (CResourceHandler::get()->existsResource(resID))
{
coverageMap[i] = msk.first.get()[i+2];
shadowCoverage[i] = msk.first.get()[i+8];
auto msk = CResourceHandler::get()->load(resID)->readAll();
width = msk.first.get()[0];
height = msk.first.get()[1];
for(int i=0; i<6; ++i)
{
coverageMap[i] = msk.first.get()[i+2];
shadowCoverage[i] = msk.first.get()[i+8];
}
}
else
{
//maximum possible size of H3 object
//TODO: remove hardcode and move this data into modding system
width = 8;
height = 6;
}
}