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:
gir489
2023-09-22 17:16:33 -04:00
committed by GitHub
parent 247536aacc
commit 220e995035
18 changed files with 388 additions and 111 deletions

View File

@ -14,6 +14,7 @@
#include "util/vehicle.hpp"
#include "yim_fipackfile.hpp"
#include <algorithm>
namespace big
{
@ -28,7 +29,7 @@ namespace big
gta_data_service::gta_data_service() :
m_peds_cache(g_file_manager.get_project_file("./cache/peds.bin"), 5),
m_vehicles_cache(g_file_manager.get_project_file("./cache/vehicles.bin"), 5),
m_vehicles_cache(g_file_manager.get_project_file("./cache/vehicles.bin"), 6),
m_update_state(eGtaDataUpdateState::IDLE)
{
if (!is_cache_up_to_date())
@ -271,7 +272,8 @@ namespace big
{
const auto item = item_node.node();
const auto name = item.child("modelName").text().as_string();
std::string name = item.child("modelName").text().as_string();
std::transform(name.begin(), name.end(), name.begin(), ::toupper);
const auto hash = rage::joaat(name);
if (protection::is_crash_vehicle(hash))
continue;
@ -281,7 +283,7 @@ namespace big
mapped_vehicles.emplace_back(hash);
auto veh = vehicle_item{};
std::strncpy(veh.m_name, name, sizeof(veh.m_name));
std::strncpy(veh.m_name, name.c_str(), sizeof(veh.m_name));
const auto manufacturer_display = item.child("vehicleMakeName").text().as_string();
std::strncpy(veh.m_display_manufacturer, manufacturer_display, sizeof(veh.m_display_manufacturer));