From ab571e22a9fbac53ada37a96e8aac2955f03952f Mon Sep 17 00:00:00 2001 From: Grinch_ Date: Sun, 17 Apr 2022 17:52:18 +0600 Subject: [PATCH] [III | VC] Fix previous commit --- src/vehicle.cpp | 14 ++++++++++---- src/vehicle.h | 4 ++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/vehicle.cpp b/src/vehicle.cpp index f8134d5..cadfe47 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -307,9 +307,9 @@ void WarpPlayerIntoVehicle(CVehicle *pVeh, int seatId) #endif #ifdef GTASA -void Vehicle::SpawnVehicle(std::string& smodel) +void Vehicle::SpawnVehicle(const std::string& smodel) #else -void Vehicle::SpawnVehicle(std::string& rootkey, std::string& vehName, std::string& smodel) +void Vehicle::SpawnVehicle(const std::string& rootkey, const std::string& vehName, const std::string& smodel) #endif { CPlayerPed* player = FindPlayerPed(); @@ -1000,10 +1000,12 @@ void Vehicle::ShowPage() ImGui::Spacing(); + int width = ImGui::GetWindowContentRegionWidth() - ImGui::GetStyle().ItemSpacing.x; #ifdef GTASA - int width = (ImGui::GetWindowContentRegionWidth() - ImGui::GetStyle().ItemSpacing.x)/2; - ImGui::SetNextItemWidth(width); + width /= 2; #endif + + ImGui::SetNextItemWidth(width); static char smodel[8]; if (ImGui::InputTextWithHint("##SpawnID", TEXT("Vehicle.IDSpawnText"), smodel, 8, ImGuiInputTextFlags_EnterReturnsTrue)) { @@ -1013,7 +1015,11 @@ void Vehicle::ShowPage() if (CModelInfo::IsCarModel(model)) { std::string str = std::string(smodel); +#ifdef GTASA SpawnVehicle(str); +#else + SpawnVehicle("", "", str); +#endif } else { diff --git a/src/vehicle.h b/src/vehicle.h index 0c1e98d..5db97e8 100644 --- a/src/vehicle.h +++ b/src/vehicle.h @@ -94,9 +94,9 @@ public: Vehicle(const Vehicle&) = delete; #ifdef GTASA - static void SpawnVehicle(std::string& name); + static void SpawnVehicle(const std::string& name); #else - static void SpawnVehicle(std::string& rootkey, std::string& vehName, std::string& model); + static void SpawnVehicle(const std::string& rootkey, const std::string& vehName, const std::string& model); #endif static void Init();