1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-13 01:20:34 +02:00

Removed most of non-const static fields in lib. Reduced header includes.

This commit is contained in:
Ivan Savenko
2024-01-09 16:43:36 +02:00
parent a15366f5a5
commit e67e4430ba
49 changed files with 139 additions and 116 deletions

View File

@ -690,7 +690,6 @@ std::shared_ptr<Bonus> JsonUtils::parseBonus(const JsonVector & ability_vec)
template <typename T>
const T parseByMap(const std::map<std::string, T> & map, const JsonNode * val, const std::string & err)
{
static T defaultValue = T();
if (!val->isNull())
{
const std::string & type = val->String();
@ -698,7 +697,7 @@ const T parseByMap(const std::map<std::string, T> & map, const JsonNode * val, c
if (it == map.end())
{
logMod->error("Error: invalid %s%s.", err, type);
return defaultValue;
return {};
}
else
{
@ -706,7 +705,7 @@ const T parseByMap(const std::map<std::string, T> & map, const JsonNode * val, c
}
}
else
return defaultValue;
return {};
}
template <typename T>