1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00
* simplify JSON values getting
* ensure initialization of Bonus fields
This commit is contained in:
alexvins
2013-03-14 17:21:16 +00:00
parent 9e7fe4d011
commit f686edc1b8
4 changed files with 14 additions and 23 deletions

View File

@@ -23,17 +23,13 @@
static inline void jsonSetString(const JsonNode& source, const std::string& name, std::string& dest)
{
const JsonNode& val = source[name];
if(!val.isNull())
{
dest = val.String();
}
dest = source[name].String();//null->empty string
}
static inline void jsonSetBool(const JsonNode& source, const std::string& name, bool& dest)
{
const JsonNode& val = source[name];
if(!val.isNull())
if(!val.isNull()) //do not rely on default value
{
dest = val.Bool();
}