Improve protections again and player database (#606)

This commit is contained in:
maybegreat48
2022-11-19 01:49:36 +00:00
committed by GitHub
parent ba3ab119d5
commit d9d53c8e42
48 changed files with 1129 additions and 803 deletions

17
src/json_util.hpp Normal file
View File

@ -0,0 +1,17 @@
#pragma once
namespace big
{
template <typename ValueType>
static inline void set_from_key_or_default(const nlohmann::json& j, const char* key, ValueType& value, ValueType default_value = {})
{
if (j.contains(key))
{
j.at(key).get_to(value);
}
else
{
value = default_value;
}
}
}