Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConsoleVariable::SetColor24 doesn't properly save #352

Closed
briaguya-ai opened this issue Oct 1, 2023 · 0 comments · Fixed by #353
Closed

ConsoleVariable::SetColor24 doesn't properly save #352

briaguya-ai opened this issue Oct 1, 2023 · 0 comments · Fixed by #353

Comments

@briaguya-ai
Copy link
Collaborator

when we set using SetColor24 the Color24 variable is set

void ConsoleVariable::SetColor24(const char* name, Color_RGB8 value) {
auto& variable = mVariables[name];
if (!variable) {
variable = std::make_shared<CVar>();
}
variable->Type = ConsoleVariableType::Color24;
variable->Color24 = value;
}

but then when we go to save the Color variable is read

} 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);
if (variable.second->Type == ConsoleVariableType::Color) {
conf->SetUInt(StringHelper::Sprintf("%s.A", keyStr), clr.a);
conf->SetString(StringHelper::Sprintf("%s.Type", keyStr), "RGBA");
} else {
conf->SetString(StringHelper::Sprintf("%s.Type", keyStr), "RGB");
}
}

leading to {0, 0, 0} always being saved for Color24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant