From 72e6c3fc62f2eea0548dc893d21029e5a655122e Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Sun, 1 Oct 2023 08:55:43 -0400 Subject: [PATCH 1/2] fix color24 saving --- src/config/ConsoleVariable.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/config/ConsoleVariable.cpp b/src/config/ConsoleVariable.cpp index 670d89306..d9c6eb9f9 100644 --- a/src/config/ConsoleVariable.cpp +++ b/src/config/ConsoleVariable.cpp @@ -186,12 +186,11 @@ void ConsoleVariable::Save() { } else if (variable.second->Type == ConsoleVariableType::Color || variable.second->Type == ConsoleVariableType::Color24) { auto keyStr = key.c_str(); - Color_RGBA8 clr = variable.second->Color; - conf->SetUInt(StringHelper::Sprintf("%s.R", keyStr), clr.r); - conf->SetUInt(StringHelper::Sprintf("%s.G", keyStr), clr.g); - conf->SetUInt(StringHelper::Sprintf("%s.B", keyStr), clr.b); + conf->SetUInt(StringHelper::Sprintf("%s.R", keyStr), variable.second->Type == ConsoleVariableType::Color ? variable.second->Color.r : variable.second->Color24.r); + conf->SetUInt(StringHelper::Sprintf("%s.G", keyStr), variable.second->Type == ConsoleVariableType::Color ? variable.second->Color.g : variable.second->Color24.g); + conf->SetUInt(StringHelper::Sprintf("%s.B", keyStr), variable.second->Type == ConsoleVariableType::Color ? variable.second->Color.b : variable.second->Color24.b); if (variable.second->Type == ConsoleVariableType::Color) { - conf->SetUInt(StringHelper::Sprintf("%s.A", keyStr), clr.a); + conf->SetUInt(StringHelper::Sprintf("%s.A", keyStr), variable.second->Color.a); conf->SetString(StringHelper::Sprintf("%s.Type", keyStr), "RGBA"); } else { conf->SetString(StringHelper::Sprintf("%s.Type", keyStr), "RGB"); From ecfffb7c9780cdc095bfc30b038a1a6e6a1b0643 Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Sun, 1 Oct 2023 08:58:18 -0400 Subject: [PATCH 2/2] clang format --- src/config/ConsoleVariable.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/config/ConsoleVariable.cpp b/src/config/ConsoleVariable.cpp index d9c6eb9f9..ee044e50a 100644 --- a/src/config/ConsoleVariable.cpp +++ b/src/config/ConsoleVariable.cpp @@ -186,9 +186,15 @@ void ConsoleVariable::Save() { } else if (variable.second->Type == ConsoleVariableType::Color || variable.second->Type == ConsoleVariableType::Color24) { auto keyStr = key.c_str(); - conf->SetUInt(StringHelper::Sprintf("%s.R", keyStr), variable.second->Type == ConsoleVariableType::Color ? variable.second->Color.r : variable.second->Color24.r); - conf->SetUInt(StringHelper::Sprintf("%s.G", keyStr), variable.second->Type == ConsoleVariableType::Color ? variable.second->Color.g : variable.second->Color24.g); - conf->SetUInt(StringHelper::Sprintf("%s.B", keyStr), variable.second->Type == ConsoleVariableType::Color ? variable.second->Color.b : variable.second->Color24.b); + conf->SetUInt(StringHelper::Sprintf("%s.R", keyStr), variable.second->Type == ConsoleVariableType::Color + ? variable.second->Color.r + : variable.second->Color24.r); + conf->SetUInt(StringHelper::Sprintf("%s.G", keyStr), variable.second->Type == ConsoleVariableType::Color + ? variable.second->Color.g + : variable.second->Color24.g); + conf->SetUInt(StringHelper::Sprintf("%s.B", keyStr), variable.second->Type == ConsoleVariableType::Color + ? variable.second->Color.b + : variable.second->Color24.b); if (variable.second->Type == ConsoleVariableType::Color) { conf->SetUInt(StringHelper::Sprintf("%s.A", keyStr), variable.second->Color.a); conf->SetString(StringHelper::Sprintf("%s.Type", keyStr), "RGBA");