refractor gta_data_service & VIEW_PLAYER_INFO_EXTRA_INFO
- changes in VIEW_PLAYER_INFO_EXTRA_INFO - add block_ptfx option in - display full vehicle name - changes in gta_data_service - change key type in vehicle_map & ped_map - add get_vehicle_full_name
This commit is contained in:
parent
f142fc711e
commit
cdc3213527
@ -98,7 +98,7 @@ namespace big
|
||||
string::operations::to_lower(item_name_lower);
|
||||
if (item_name_lower.find(args_lower) != std::string::npos)
|
||||
{
|
||||
result.push(rage::joaat(item.first));
|
||||
result.push(rage::joaat(item.second.m_name));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ namespace big
|
||||
string::operations::to_lower(args_lower);
|
||||
if (item_name_lower.find(args_lower) != std::string::npos)
|
||||
{
|
||||
result.push(rage::joaat(item.first));
|
||||
result.push(rage::joaat(item.second.m_name));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -206,25 +206,15 @@ namespace big
|
||||
|
||||
if (info->get_model_type() == eModelType::Vehicle)
|
||||
{
|
||||
for (auto& [name, data] : g_gta_data_service.vehicles())
|
||||
{
|
||||
if (data.m_hash == model)
|
||||
{
|
||||
model_str = name.data();
|
||||
break;
|
||||
}
|
||||
}
|
||||
auto& vehicles = g_gta_data_service.vehicles();
|
||||
if(auto it = vehicles.find(model); it != vehicles.end())
|
||||
model_str = it->second.m_name;
|
||||
}
|
||||
else if (info->get_model_type() == eModelType::Ped)
|
||||
{
|
||||
for (auto& [name, data] : g_gta_data_service.peds())
|
||||
{
|
||||
if (data.m_hash == model)
|
||||
{
|
||||
model_str = name.data();
|
||||
break;
|
||||
}
|
||||
}
|
||||
auto& peds = g_gta_data_service.peds();
|
||||
if(auto it = peds.find(model); it != peds.end())
|
||||
model_str = it->second.m_name;
|
||||
}
|
||||
|
||||
if (!model_str)
|
||||
|
@ -72,17 +72,17 @@ namespace big
|
||||
// innefficient getters, don't care to fix right now
|
||||
const ped_item& gta_data_service::ped_by_hash(uint32_t hash)
|
||||
{
|
||||
for (const auto& [name, ped] : m_peds)
|
||||
if (ped.m_hash == hash)
|
||||
return ped;
|
||||
if(auto it = m_peds.find(hash); it != m_peds.end())
|
||||
return it->second;
|
||||
|
||||
return gta_data_service::empty_ped;
|
||||
}
|
||||
|
||||
const vehicle_item& gta_data_service::vehicle_by_hash(uint32_t hash)
|
||||
{
|
||||
for (const auto& [name, veh] : m_vehicles)
|
||||
if (veh.m_hash == hash)
|
||||
return veh;
|
||||
if(auto it = m_vehicles.find(hash); it != m_vehicles.end())
|
||||
return it->second;
|
||||
|
||||
return gta_data_service::empty_vehicle;
|
||||
}
|
||||
|
||||
@ -181,7 +181,7 @@ namespace big
|
||||
const auto ped = cached_peds[i];
|
||||
|
||||
add_if_not_exists(m_ped_types, ped.m_ped_type);
|
||||
m_peds.insert({ped.m_name, ped});
|
||||
m_peds.insert({ped.m_hash, ped});
|
||||
}
|
||||
|
||||
std::sort(m_ped_types.begin(), m_ped_types.end());
|
||||
@ -203,7 +203,7 @@ namespace big
|
||||
const auto vehicle = cached_vehicles[i];
|
||||
|
||||
add_if_not_exists(m_vehicle_classes, vehicle.m_vehicle_class);
|
||||
m_vehicles.insert({vehicle.m_name, vehicle});
|
||||
m_vehicles.insert({vehicle.m_hash, vehicle});
|
||||
}
|
||||
|
||||
std::sort(m_vehicle_classes.begin(), m_vehicle_classes.end());
|
||||
|
@ -14,8 +14,8 @@ namespace big
|
||||
UPDATING
|
||||
};
|
||||
|
||||
using ped_map = std::map<std::string, ped_item>;
|
||||
using vehicle_map = std::map<std::string, vehicle_item>;
|
||||
using ped_map = std::map<uint32_t, ped_item>;
|
||||
using vehicle_map = std::map<uint32_t, vehicle_item>;
|
||||
using string_vec = std::vector<std::string>;
|
||||
|
||||
class gta_data_service final
|
||||
@ -58,6 +58,11 @@ namespace big
|
||||
return m_weapons_cache.weapon_components;
|
||||
}
|
||||
|
||||
std::string get_vehicle_full_name(vehicle_item veh);
|
||||
{
|
||||
return std::format("{} {} {}", veh.m_vehicle_class, veh.m_display_manufacturer, veh.m_display_name);
|
||||
}
|
||||
|
||||
private:
|
||||
bool is_cache_up_to_date();
|
||||
|
||||
|
@ -246,7 +246,8 @@ namespace big
|
||||
|
||||
if (CVehicleModelInfo* vehicle_model_info = static_cast<CVehicleModelInfo*>(vehicle->m_model_info))
|
||||
{
|
||||
vehicle_name = g_gta_data_service.vehicles()[vehicle_model_info->m_name].m_display_name; // TODO
|
||||
auto vehicle_item = g_gta_data_service.vehicles()[vehicle_model_info->m_hash];
|
||||
vehicle_name = g_gta_data_service.get_vehicle_full_name(vehicle_item);
|
||||
}
|
||||
|
||||
if (veh_damage_bits & (uint32_t)eEntityProofs::GOD)
|
||||
|
Reference in New Issue
Block a user