fix(cache): weapon cache weapon types array not filled properly when filling from cache file (#1726)

This commit is contained in:
Quentin 2023-07-16 12:04:24 +02:00 committed by GitHub
parent d12c1309c4
commit 8c097f0915
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 2 deletions

View File

@ -163,8 +163,7 @@ namespace big
load_peds();
load_vehicles();
LOG(INFO) << "Loading " << m_weapons_cache.weapon_map.size() << " weapons from cache.";
LOG(INFO) << "Loading " << m_weapons_cache.weapon_components.size() << " weapon components from cache.";
load_weapons();
LOG(VERBOSE) << "Loaded all data from cache.";
}
@ -205,6 +204,19 @@ namespace big
m_vehicles_cache.free();
}
void gta_data_service::load_weapons()
{
LOG(INFO) << "Loading " << m_weapons_cache.weapon_map.size() << " weapons from cache.";
LOG(INFO) << "Loading " << m_weapons_cache.weapon_components.size() << " weapon components from cache.";
for (const auto& [_, weapon] : m_weapons_cache.weapon_map)
{
add_if_not_exists(m_weapon_types, weapon.m_weapon_type);
}
std::sort(m_weapon_types.begin(), m_weapon_types.end());
}
inline void parse_ped(std::vector<ped_item>& peds, std::vector<std::uint32_t>& mapped_peds, pugi::xml_document& doc)
{
const auto& items = doc.select_nodes("/CPedModelInfo__InitDataList/InitDatas/Item");

View File

@ -62,6 +62,7 @@ namespace big
void load_data();
void load_peds();
void load_vehicles();
void load_weapons();
void rebuild_cache();