From 28ea13c762da6780a7d9f4b3c52cfa8c5b6e96bb Mon Sep 17 00:00:00 2001 From: Riyyi Date: Wed, 6 Jan 2021 00:29:38 +0100 Subject: [PATCH] Convert Settings::load() to use a reference --- inferno/src/inferno/settings.cpp | 9 ++++----- inferno/src/inferno/settings.h | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/inferno/src/inferno/settings.cpp b/inferno/src/inferno/settings.cpp index 4f6bd34..34ef6a6 100644 --- a/inferno/src/inferno/settings.cpp +++ b/inferno/src/inferno/settings.cpp @@ -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(); @@ -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() diff --git a/inferno/src/inferno/settings.h b/inferno/src/inferno/settings.h index 251a99c..b9d6af3 100644 --- a/inferno/src/inferno/settings.h +++ b/inferno/src/inferno/settings.h @@ -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; }