1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

Small (temp) fix. Prevent nulls from serialization.

This commit is contained in:
AlexVinS 2015-11-14 19:47:29 +03:00
parent 2d5a366e6c
commit 2d777ea676
3 changed files with 8 additions and 6 deletions

View File

@ -362,7 +362,7 @@ void CGObjectInstance::readJson(const JsonNode & json, bool withState)
void CGObjectInstance::writeJsonOptions(JsonNode & json) const
{
json.setType(JsonNode::DATA_STRUCT);
}
void CGObjectInstance::readJsonOptions(const JsonNode & json)
@ -372,7 +372,7 @@ void CGObjectInstance::readJsonOptions(const JsonNode & json)
void CGObjectInstance::writeJsonState(JsonNode & json) const
{
json.setType(JsonNode::DATA_STRUCT);
}
void CGObjectInstance::readJsonState(const JsonNode & json)

View File

@ -258,10 +258,10 @@ void ObjectTemplate::readJson(const JsonNode &node)
void ObjectTemplate::writeJson(JsonNode & node) const
{
node.setType(JsonNode::DATA_STRUCT);
//todo: ObjectTemplate::writeJson
}
ui32 ObjectTemplate::getWidth() const
{
return usedTiles.empty() ? 0 : usedTiles.front().size();

View File

@ -72,6 +72,9 @@ namespace TriggeredEventsDetail
//todo: save identifier
if(event.objectType != -1)
data["type"].Float() = event.objectType;
if(event.value != -1)
data["value"].Float() = event.value;
@ -84,7 +87,8 @@ namespace TriggeredEventsDetail
position[2].Float() = event.position.z;
}
asVector.push_back(data);
if(!data.isNull())
asVector.push_back(data);
return std::move(json);
}
@ -590,8 +594,6 @@ void CMapLoaderJson::MapObjectLoader::construct()
return;
}
si32 type = owner->getIdentifier("object", typeName);
handler = VLC->objtypeh->getHandlerFor(typeName, subTypeName);
instance = handler->create(ObjectTemplate());