From c41bb4d45d6a48e51a7b7c2d060dd41225270a30 Mon Sep 17 00:00:00 2001 From: Baoulettes Date: Sat, 21 May 2022 17:32:05 +0200 Subject: [PATCH] C++ ? and build fix I think --- libultraship/libultraship/SohImGuiImpl.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/libultraship/libultraship/SohImGuiImpl.cpp b/libultraship/libultraship/SohImGuiImpl.cpp index 0f1d06e64..68e640b93 100644 --- a/libultraship/libultraship/SohImGuiImpl.cpp +++ b/libultraship/libultraship/SohImGuiImpl.cpp @@ -390,7 +390,7 @@ namespace SohImGui { } } - void EnhancementRadioButton(std::string text, std::string cvarName, int id) { + void EnhancementRadioButton(const char* text, const char* cvarName, int id) { /*Usage : EnhancementRadioButton("My Visible Name","gMyCVarName", MyID); First arg is the visible name of the Radio button @@ -401,14 +401,12 @@ namespace SohImGui { EnhancementRadioButton("German", "gLanguages", 1); EnhancementRadioButton("French", "gLanguages", 2); */ - char* unique_name = (char* ) malloc(1 + strlen(text)+ strlen(cvarName)); - strcpy(unique_name, text); - strcat(unique_name, cvarName); - char* non_visible_unique_name = (char* ) malloc(1 + strlen("##")+ strlen(unique_name)); - strcpy(non_visible_unique_name, "##"); - strcat(non_visible_unique_name, unique_name); + std::string make_invisible = "##"; + make_invisible += text; + make_invisible += cvarName; + int val = CVar_GetS32(cvarName, 0); - if (ImGui::RadioButton(non_visible_unique_name, id == val)) { + if (ImGui::RadioButton(make_invisible.c_str(), id == val)) { CVar_SetS32(cvarName, id); needs_save = true; }