1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Use JsonSerializeFormat for map objects

This commit is contained in:
AlexVinS
2016-02-22 02:37:19 +03:00
parent 15a4a11560
commit dd1aabbe23
19 changed files with 344 additions and 366 deletions

View File

@@ -48,6 +48,24 @@ void JsonDeserializer::serializeIntEnum(const std::string & fieldName, const std
value = rawValue;
}
void JsonDeserializer::serializeIntId(const std::string & fieldName, const TDecoder & decoder, const TEncoder & encoder, const si32 defaultValue, si32 & value)
{
std::string identifier;
serializeString(fieldName, identifier);
if(identifier == "")
{
value = defaultValue;
return;
}
si32 rawId = decoder(identifier);
if(rawId >= 0)
value = rawId;
else
value = defaultValue;
}
void JsonDeserializer::serializeLIC(const std::string & fieldName, const TDecoder & decoder, const TEncoder & encoder, const std::vector<bool> & standard, std::vector<bool> & value)
{
const JsonNode & field = current->operator[](fieldName);