mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-22 22:33:43 -07:00
C++ ? and build fix I think
This commit is contained in:
parent
ad9bdaf4a0
commit
c41bb4d45d
1 changed files with 6 additions and 8 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue