Convert Settings::load() to use a reference

This commit is contained in:
Riyyi
2021-01-06 00:29:38 +01:00
parent cedce5e104
commit 28ea13c762
2 changed files with 5 additions and 6 deletions
+4 -5
View File
@@ -18,7 +18,8 @@ namespace Inferno {
void Settings::update()
{
nlohmann::json json = Settings::load();
nlohmann::json json;
Settings::load(json);
try {
m_properties.window.title = json["window"]["title"].get<std::string>();
@@ -36,13 +37,11 @@ namespace Inferno {
{
}
nlohmann::json Settings::load()
bool Settings::load(nlohmann::json& json)
{
nlohmann::json json;
File::ioRead(json, m_path);
return json;
return true;
}
bool Settings::save()
+1 -1
View File
@@ -17,7 +17,7 @@ namespace Inferno {
static void update();
static void destroy();
static nlohmann::json load();
static bool load(nlohmann::json& json);
static bool save();
static inline SettingsProperties& get() { return m_properties; }