Emills suggestion

This commit is contained in:
louist103 2022-05-16 14:00:30 -04:00
commit ee7a55dee3

View file

@ -536,10 +536,10 @@ namespace SohImGui {
void EnhancementColor3(const char* text, const char* cvarName, float defaultColors[3]) void EnhancementColor3(const char* text, const char* cvarName, float defaultColors[3])
{ {
std::string cVarNameStr(cvarName);
int r = CVar_GetS32((std::string(cvarName) + "_Red").c_str(), (int32_t)(defaultColors[0] * 255.0f)); const int r = CVar_GetS32((cVarNameStr + "_Red").c_str(), (int32_t)(defaultColors[0] * 255.0f));
int g = CVar_GetS32((std::string(cvarName) + "_Green").c_str(), (int32_t)(defaultColors[1] * 255.0f)); const int g = CVar_GetS32((cVarNameStr + "_Green").c_str(), (int32_t)(defaultColors[1] * 255.0f));
int b = CVar_GetS32((std::string(cvarName) + "_Blue").c_str(), (int32_t)(defaultColors[2] * 255.0f)); const int b = CVar_GetS32((cVarNameStr + "_Blue").c_str(), (int32_t)(defaultColors[2] * 255.0f));
float colors[3]; float colors[3];
@ -550,9 +550,9 @@ namespace SohImGui {
{ {
if (ImGui::ColorEdit3(text, colors)) if (ImGui::ColorEdit3(text, colors))
{ {
CVar_SetS32((std::string(cvarName) + "_Red").c_str(), (int)(colors[0] * 255)); CVar_SetS32((cVarNameStr + "_Red").c_str(), (int)(colors[0] * 255));
CVar_SetS32((std::string(cvarName) + "_Green").c_str(), (int)(colors[1] * 255)); CVar_SetS32((cVarNameStr + "_Green").c_str(), (int)(colors[1] * 255));
CVar_SetS32((std::string(cvarName) + "_Blue").c_str(), (int)(colors[2] * 255)); CVar_SetS32((cVarNameStr + "_Blue").c_str(), (int)(colors[2] * 255));
needs_save = true; needs_save = true;
} }
} }