From ee7a55dee3835dcf40ea7b815e88a4777b2078be Mon Sep 17 00:00:00 2001 From: louist103 Date: Mon, 16 May 2022 14:00:30 -0400 Subject: [PATCH] Emills suggestion --- libultraship/libultraship/SohImGuiImpl.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libultraship/libultraship/SohImGuiImpl.cpp b/libultraship/libultraship/SohImGuiImpl.cpp index 1b02275c3..3ab6c6ec4 100644 --- a/libultraship/libultraship/SohImGuiImpl.cpp +++ b/libultraship/libultraship/SohImGuiImpl.cpp @@ -536,10 +536,10 @@ namespace SohImGui { void EnhancementColor3(const char* text, const char* cvarName, float defaultColors[3]) { - - int r = CVar_GetS32((std::string(cvarName) + "_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)); - int b = CVar_GetS32((std::string(cvarName) + "_Blue").c_str(), (int32_t)(defaultColors[2] * 255.0f)); + std::string cVarNameStr(cvarName); + const int r = CVar_GetS32((cVarNameStr + "_Red").c_str(), (int32_t)(defaultColors[0] * 255.0f)); + const int g = CVar_GetS32((cVarNameStr + "_Green").c_str(), (int32_t)(defaultColors[1] * 255.0f)); + const int b = CVar_GetS32((cVarNameStr + "_Blue").c_str(), (int32_t)(defaultColors[2] * 255.0f)); float colors[3]; @@ -550,9 +550,9 @@ namespace SohImGui { { if (ImGui::ColorEdit3(text, colors)) { - CVar_SetS32((std::string(cvarName) + "_Red").c_str(), (int)(colors[0] * 255)); - CVar_SetS32((std::string(cvarName) + "_Green").c_str(), (int)(colors[1] * 255)); - CVar_SetS32((std::string(cvarName) + "_Blue").c_str(), (int)(colors[2] * 255)); + CVar_SetS32((cVarNameStr + "_Red").c_str(), (int)(colors[0] * 255)); + CVar_SetS32((cVarNameStr + "_Green").c_str(), (int)(colors[1] * 255)); + CVar_SetS32((cVarNameStr + "_Blue").c_str(), (int)(colors[2] * 255)); needs_save = true; } }