From 14e2ba358ecebe2780c64f97711ae4bdc09eef40 Mon Sep 17 00:00:00 2001 From: Grinch_ Date: Tue, 15 Jun 2021 23:11:11 +0600 Subject: [PATCH] Clean up code --- CheatMenu/Menu.cpp | 6 +++--- CheatMenu/Ped.cpp | 2 +- CheatMenu/Ui.cpp | 12 ++++++------ CheatMenu/Vehicle.cpp | 2 +- CheatMenu/Visual.cpp | 36 ++++++++++++++++++------------------ CheatMenu/Weapon.cpp | 2 +- 6 files changed, 30 insertions(+), 30 deletions(-) diff --git a/CheatMenu/Menu.cpp b/CheatMenu/Menu.cpp index dce14a2..dd50bea 100644 --- a/CheatMenu/Menu.cpp +++ b/CheatMenu/Menu.cpp @@ -487,11 +487,11 @@ void Menu::Draw() ImGui::Columns(2, NULL, false); ImGui::Text("Author: Grinch_"); - ImGui::Text((std::string("Version: ") + MENU_VERSION).c_str()); + ImGui::Text("Version: %s",MENU_VERSION); ImGui::NextColumn(); - ImGui::Text(std::string("ImGui: " + std::string(ImGui::GetVersion())).c_str()); - ImGui::Text((std::string("Build: ") + BUILD_NUMBER).c_str()); + ImGui::Text("ImGui: %s", ImGui::GetVersion()); + ImGui::Text("Build: %s", BUILD_NUMBER); ImGui::Columns(1); diff --git a/CheatMenu/Ped.cpp b/CheatMenu/Ped.cpp index 6469129..e20f35e 100644 --- a/CheatMenu/Ped.cpp +++ b/CheatMenu/Ped.cpp @@ -253,7 +253,7 @@ void Ped::Draw() Ui::ListBox("Ped type", spawn_ped::ped_type, spawn_ped::selected_ped_type); ImGui::Spacing(); - ImGui::Text((std::string("Selected weapon: ") + Weapon::weapon_json.data[std::to_string(spawn_ped::weapon_id)].get()).c_str()); + ImGui::Text("Selected weapon: %s", Weapon::weapon_json.data[std::to_string(spawn_ped::weapon_id)].get()); ImGui::Spacing(); Ui::DrawImages(Weapon::weapon_vec, ImVec2(65, 65), Weapon::search_categories, Weapon::selected_item, Weapon::filter, [](std::string str) { spawn_ped::weapon_id = std::stoi(str); }, diff --git a/CheatMenu/Ui.cpp b/CheatMenu/Ui.cpp index 47b4c55..0f3b08e 100644 --- a/CheatMenu/Ui.cpp +++ b/CheatMenu/Ui.cpp @@ -405,11 +405,11 @@ void Ui::EditStat(const char* label, const int stat_id, const int min, const int int val = static_cast(CStats::GetStatValue(stat_id)); ImGui::Columns(3, 0, false); - ImGui::Text(("Min: " + std::to_string(min)).c_str()); + ImGui::Text("Min: %d", min); ImGui::NextColumn(); - ImGui::Text(("Def: " + std::to_string(def)).c_str()); + ImGui::Text("Def: %d", def); ImGui::NextColumn(); - ImGui::Text(("Max: " + std::to_string(max)).c_str()); + ImGui::Text("Max: %d", max); ImGui::Columns(1); ImGui::Spacing(); @@ -723,16 +723,16 @@ void Ui::EditFloat(const char* label, const int address, const float min, const ImGui::Columns(items, 0, false); - ImGui::Text(("Min: " + std::to_string(min)).c_str()); + ImGui::Text("Min: %f", min); if (items == 3) { ImGui::NextColumn(); - ImGui::Text(("Def: " + std::to_string(def)).c_str()); + ImGui::Text("Def: %f", def); } ImGui::NextColumn(); - ImGui::Text(("Max: " + std::to_string(max)).c_str()); + ImGui::Text("Max: %f", max); ImGui::Columns(1); ImGui::Spacing(); diff --git a/CheatMenu/Vehicle.cpp b/CheatMenu/Vehicle.cpp index 41f1575..eb0370e 100644 --- a/CheatMenu/Vehicle.cpp +++ b/CheatMenu/Vehicle.cpp @@ -759,7 +759,7 @@ void Vehicle::Draw() ImGui::Text(GetNameFromModel(veh->m_nModelIndex).c_str()); ImGui::NextColumn(); - ImGui::Text((std::string("Total seats: ") + std::to_string(seats + 1)).c_str()); + ImGui::Text("Total seats: %d", (seats + 1)); ImGui::Columns(1); ImGui::Spacing(); diff --git a/CheatMenu/Visual.cpp b/CheatMenu/Visual.cpp index 69fc748..be0c1f6 100644 --- a/CheatMenu/Visual.cpp +++ b/CheatMenu/Visual.cpp @@ -287,39 +287,39 @@ void Visual::Draw() ImGui::TextWrapped("These options won't work if you got any mods that drastically changes the game hud. i.e. Mobile Hud, GTA 5 Hud etc."); ImGui::Spacing(); Ui::ColorPickerAddress("Armourbar color", *(int*)0x5890FC, ImVec4(180, 25, 29, 255)); - Ui::EditAddress("Armourbar fPosX ", 0x866B78, -999, 94, 999); - Ui::EditAddress("Armourbar fPosY ", 0x862D38, -999, 48, 999); + Ui::EditAddress("Armourbar posX", 0x866B78, -999, 94, 999); + Ui::EditAddress("Armourbar posY", 0x862D38, -999, 48, 999); Ui::ColorPickerAddress("Breathbar color", *(int*)0x5891EB, ImVec4(172, 203, 241, 255)); - Ui::EditAddress("Breathbar fPosX ", *(int*)0x58F11F, -999, 94, 999); - Ui::EditAddress("Breathbar fPosY ", *(int*)0x58F100, -999, 62, 999); + Ui::EditAddress("Breathbar posX", *(int*)0x58F11F, -999, 94, 999); + Ui::EditAddress("Breathbar posY", *(int*)0x58F100, -999, 62, 999); Ui::ColorPickerAddress("Clock color", *(int*)0x58EBD1, ImVec4(180, 25, 29, 255)); - Ui::EditAddress("Clock fPosX ", *(int*)0x58EC16, -999, 32, 999); - Ui::EditAddress("Clock fPosY ", *(int*)0x58EC04, -999, 22, 999); + Ui::EditAddress("Clock posX", *(int*)0x58EC16, -999, 32, 999); + Ui::EditAddress("Clock posY", *(int*)0x58EC04, -999, 22, 999); Ui::ColorPickerAddress("Healthbar color", *(int*)0x589331, ImVec4(180, 25, 29, 255)); - Ui::EditAddress("Healthbar fPosX ", 0x86535C, -999, 141, 999); - Ui::EditAddress("Healthbar fPosY ", 0x866CA8, -999, 77, 999); + Ui::EditAddress("Healthbar posX", 0x86535C, -999, 141, 999); + Ui::EditAddress("Healthbar posY", 0x866CA8, -999, 77, 999); Ui::ColorPickerAddress("Draw menu title border color", 0xBAB240, ImVec4(0, 0, 0, 255)); Ui::ColorPickerAddress("Money color", 0xBAB230, ImVec4(54, 104, 44, 255)); - Ui::EditAddress("Money fPosX ", *(int*)0x58F5FC, -999, 32, 999); - Ui::EditAddress("Money fPosY ", 0x866C88, -999, 89, 999); + Ui::EditAddress("Money posX", *(int*)0x58F5FC, -999, 32, 999); + Ui::EditAddress("Money posY", 0x866C88, -999, 89, 999); static std::vector font_outline{ { "No outline", 0 }, { "Thin outline" ,1 }, { "Default outline" ,2 } }; Ui::EditRadioButtonAddressEx("Money font outline", 0x58F58D, font_outline); static std::vector style{ { "Style 1", 1 }, { "Style 2" ,2 }, { "Default style" ,3 } }; Ui::EditRadioButtonAddressEx("Money font style", 0x58F57F, style); Ui::EditAddress("Radar Height", *(int*)0x5834F6, 0, 76, 999); Ui::EditAddress("Radar Width", *(int*)0x5834C2, 0, 94, 999); - Ui::EditAddress("Radar fPosX", *(int*)0x5834D4, -999, 40, 999); - Ui::EditAddress("Radar fPosY", *(int*)0x583500, -999, 104, 999); + Ui::EditAddress("Radar posX", *(int*)0x5834D4, -999, 40, 999); + Ui::EditAddress("Radar posY", *(int*)0x583500, -999, 104, 999); Ui::EditAddress("Radar zoom", 0xA444A3, 0, 0, 170); Ui::ColorPickerAddress("Radio station color", 0xBAB24C, ImVec4(150, 150, 150, 255)); static std::vector star_border{ { "No border", 0 }, { "Default" ,1 }, { "Bold border" ,2 } }; Ui::EditRadioButtonAddressEx("Wanted star border", 0x58DD41, star_border); - Ui::EditAddress("Wanted fPosX ", *(int*)0x58DD0F, -999, 29, 999); - Ui::EditAddress("Wanted fPosY ", *(int*)0x58DDFC, -999, 114, 999); - Ui::EditAddress("Weapon ammo fPosX ", *(int*)0x58FA02, -999, 32, 999); - Ui::EditAddress("Weapon ammo fPosY ", *(int*)0x58F9E6, -999, 43, 999); - Ui::EditAddress("Weapon icon fPosX ", *(int*)0x58F927, -999, 32, 999); - Ui::EditAddress("Weapon icon fPosY ", *(int*)0x58F913, -999, 20, 999); + Ui::EditAddress("Wanted posX", *(int*)0x58DD0F, -999, 29, 999); + Ui::EditAddress("Wanted posY", *(int*)0x58DDFC, -999, 114, 999); + Ui::EditAddress("Weapon ammo posX", *(int*)0x58FA02, -999, 32, 999); + Ui::EditAddress("Weapon ammo posY", *(int*)0x58F9E6, -999, 43, 999); + Ui::EditAddress("Weapon icon posX", *(int*)0x58F927, -999, 32, 999); + Ui::EditAddress("Weapon icon posY", *(int*)0x58F913, -999, 20, 999); ImGui::EndChild(); } diff --git a/CheatMenu/Weapon.cpp b/CheatMenu/Weapon.cpp index 93bbcb4..fc08b2e 100644 --- a/CheatMenu/Weapon.cpp +++ b/CheatMenu/Weapon.cpp @@ -198,7 +198,7 @@ void Weapon::Draw() ImGui::Columns(1); ImGui::Spacing(); - ImGui::Text((std::string("Current weapon: ") + weapon_json.data[std::to_string(gang_weapons[selected_gang][selected_weapon_count])].get()).c_str()); + ImGui::Text("Current weapon: %s", weapon_json.data[std::to_string(gang_weapons[selected_gang][selected_weapon_count])].get()); ImGui::Spacing(); Ui::DrawImages(weapon_vec, ImVec2(65, 65), search_categories, selected_item, filter, SetGangWeapon, nullptr, [](std::string str) {return weapon_json.data[str].get(); },