1
0
forked from 0ad/0ad

Fixes behaviour change in Atlas' JSON serialization after the switch to JSON Spirit (#2434).

This caused problems setting the starting camera.

Refs #2434

This was SVN commit r14827.
This commit is contained in:
Yves 2014-03-09 17:55:54 +00:00
parent 8959e63a53
commit 0e7c92e1e6

View File

@ -100,6 +100,10 @@ static AtSmartPtr<AtNode> ConvertNode(json_spirit::Value node)
));
}
}
else if (node.type() == json_spirit::null_type)
{
return obj;
}
else
{
assert(! "Unimplemented type found when parsing JSON!");
@ -172,7 +176,11 @@ json_spirit::Value BuildJSONNode(AtNode::Ptr p)
for (AtNode::child_maptype::const_iterator it = p->children.begin(); it != p->children.end(); ++it)
{
json_spirit::Value child = BuildJSONNode(it->second);
rval.push_back(json_spirit::Pair(it->first.c_str(), child));
// We don't serialize childs with null value.
// Instead of something like this we omit the whole property: "StartingCamera": null
// There's no special reason for that, it's just the same behaviour the previous implementations had.
if (child.type() != json_spirit::null_type)
rval.push_back(json_spirit::Pair(it->first.c_str(), child));
}
return rval;