mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-23 22:37:55 +02:00
Cleanup
* simplify JSON values getting * ensure initialization of Bonus fields
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user