Add Garage drop-down to Spawn PV menu (#2171)
* Fixed edge case where a garage that contained only banned vehicles would show if the user was using Spawn Clone. Refactored a large portion of the garage code to be production ready. Formatting changes. * Added singular garage items to the m_garage setter like the Terrorbyte. * Fixed is_blacklisted_vehicle returning an inverted condition. Fixed Garage drop-down not updating properly. * Separated out m_garage's setter into a ctor function. Replaced the 4 singular garages that use an overloaded index with a define to be able to shift them easier when new properties are added. * Removed obsolete and incorrect player.character_slot config entry. Removed deprecated local_player.hpp. Added self::char_slot that is guaranteed to be correct. * Removed extraneous semi-colon. * Added more stuff to fillsnacks. Removed more extraneous usages of MPPLY_LAST_MP_CHAR. * Added the vehicle's name to player info. * Fixed get_property_garage_size returning the incorrect size for the facility. Fixed get_static_property_name returning the Nightclub's name instead of Nightclub Service Entrance to maintain consistency with the Mechanic. Fixed garage_slot_iterator not starting and ending at the correct indexes. * Shifted the singular properties down one to compensate for the new math. * Fixed backwards math on Terrorbyte and Nightclub B1. * Fixed garage not being updated when the player moved the vehicle. * Fixed backwards comments.
This commit is contained in:
@ -8,32 +8,6 @@
|
||||
|
||||
namespace big
|
||||
{
|
||||
bool is_blacklist_vehicle(Hash vehicle_hash)
|
||||
{
|
||||
switch (vehicle_hash)
|
||||
{
|
||||
case RAGE_JOAAT("avenger"):
|
||||
case RAGE_JOAAT("avenger3"):
|
||||
case RAGE_JOAAT("hauler2"):
|
||||
case RAGE_JOAAT("phantom3"):
|
||||
case RAGE_JOAAT("trailersmall2"):
|
||||
case RAGE_JOAAT("khanjali"):
|
||||
case RAGE_JOAAT("chernobog"):
|
||||
case RAGE_JOAAT("riot2"):
|
||||
case RAGE_JOAAT("thruster"):
|
||||
case RAGE_JOAAT("brickade2"):
|
||||
case RAGE_JOAAT("manchez3"):
|
||||
case RAGE_JOAAT("terbyte"):
|
||||
case RAGE_JOAAT("speedo4"):
|
||||
case RAGE_JOAAT("mule4"):
|
||||
case RAGE_JOAAT("pounder2"):
|
||||
case RAGE_JOAAT("rcbandito"):
|
||||
case RAGE_JOAAT("minitank"):
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void view::pv()
|
||||
{
|
||||
ImGui::SetWindowSize({0.f, (float)*g_pointers->m_gta.m_resolution_y}, ImGuiCond_Always);
|
||||
@ -55,7 +29,10 @@ namespace big
|
||||
|
||||
static char plate_buf[9] = {0};
|
||||
|
||||
ImGui::Checkbox("SPAWN_CLONE"_T.data(), &g.clone_pv.spawn_clone);
|
||||
if (ImGui::Checkbox("SPAWN_CLONE"_T.data(), &g.clone_pv.spawn_clone))
|
||||
{
|
||||
g_mobile_service->refresh_garages();
|
||||
}
|
||||
if (ImGui::IsItemHovered())
|
||||
ImGui::SetTooltip("SPAWN_CLONE_DESC"_T.data());
|
||||
if (g.clone_pv.spawn_clone)
|
||||
@ -106,6 +83,28 @@ namespace big
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
|
||||
ImGui::SetNextItemWidth(300.f);
|
||||
std::string garage_display = g.clone_pv.garage.empty() ? "ALL"_T.data() : g.clone_pv.garage;
|
||||
if (ImGui::BeginCombo("GARAGE"_T.data(), garage_display.c_str()))
|
||||
{
|
||||
if (ImGui::Selectable("ALL"_T.data(), g.clone_pv.garage.empty()))
|
||||
{
|
||||
g.clone_pv.garage.clear();
|
||||
}
|
||||
for (auto garage : g_mobile_service->garages())
|
||||
{
|
||||
if (ImGui::Selectable(garage.c_str(), garage == g.clone_pv.garage))
|
||||
{
|
||||
g.clone_pv.garage = garage;
|
||||
}
|
||||
if (garage == g.clone_pv.garage)
|
||||
{
|
||||
ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
|
||||
static char search[64];
|
||||
|
||||
@ -138,7 +137,7 @@ namespace big
|
||||
if ((selected_class == -1 || class_arr[selected_class] == vehicle_class)
|
||||
&& (display_name.find(lower_search) != std::string::npos || display_manufacturer.find(lower_search) != std::string::npos))
|
||||
{
|
||||
if (!g.clone_pv.spawn_clone && is_blacklist_vehicle(personal_veh->get_hash()))
|
||||
if (personal_veh->is_blacklisted_vehicle() || !personal_veh->is_in_selected_garage())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
Reference in New Issue
Block a user