Skip to content

Commit ef344bb

Browse files
committed
fix: Another attempt to fix CI.
This mostly reverts commit 169df1a.
1 parent 169df1a commit ef344bb

5 files changed

Lines changed: 18 additions & 18 deletions

File tree

src/services/gta_data/gta_data_service.cpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,14 @@ namespace big
2424
return false;
2525
}
2626

27+
static weapon_item empty_weapon;
28+
static weapon_component empty_component;
29+
2730
gta_data_service::gta_data_service() :
2831
m_update_state(eGtaDataUpdateState::IDLE)
2932
{
33+
empty_weapon = {};
34+
empty_component = {};
3035
}
3136

3237
bool gta_data_service::init()
@@ -88,23 +93,23 @@ namespace big
8893
for (const auto& [name, weapon] : m_weapons_cache.weapon_map)
8994
if (weapon.m_hash == hash)
9095
return weapon;
91-
return gta_data_service::empty_weapon;
96+
return empty_weapon;
9297
}
9398

9499
const weapon_component& gta_data_service::weapon_component_by_hash(uint32_t hash)
95100
{
96101
for (const auto& [name, component] : m_weapons_cache.weapon_components)
97102
if (component.m_hash == hash)
98103
return component;
99-
return gta_data_service::empty_component;
104+
return empty_component;
100105
}
101106

102107
const weapon_component& gta_data_service::weapon_component_by_name(std::string name)
103108
{
104109
for (const auto& [name_key, component] : m_weapons_cache.weapon_components)
105110
if (name_key == name)
106111
return component;
107-
return gta_data_service::empty_component;
112+
return empty_component;
108113
}
109114

110115
string_vec& gta_data_service::ped_types()
@@ -275,9 +280,9 @@ namespace big
275280

276281
std::vector<ped_item> peds;
277282
std::vector<vehicle_item> vehicles;
278-
//std::vector<weapon_item_parsed> weapons;
283+
//std::vector<weapon_item> weapons;
279284
std::unordered_map<Hash, weapon_item_parsed> weapons;
280-
std::vector<weapon_component_parsed> weapon_components;
285+
std::vector<weapon_component> weapon_components;
281286

282287
constexpr auto exists = [](const hash_array& arr, uint32_t val) -> bool {
283288
return std::find(arr.begin(), arr.end(), val) != arr.end();
@@ -354,7 +359,7 @@ namespace big
354359
if (LocDesc.ends_with("INVALID"))
355360
LocDesc.clear();
356361

357-
weapon_component_parsed component;
362+
weapon_component component;
358363

359364
component.m_name = name;
360365
component.m_hash = hash;

src/services/gta_data/gta_data_service.hpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ namespace big
4949
{
5050
return m_vehicles;
5151
}
52-
std::map<std::string, weapon_item_parsed>& weapons()
52+
std::map<std::string, weapon_item>& weapons()
5353
{
5454
return m_weapons_cache.weapon_map;
5555
}
56-
std::map<std::string, weapon_component_parsed>& weapon_components()
56+
std::map<std::string, weapon_component>& weapon_components()
5757
{
5858
return m_weapons_cache.weapon_components;
5959
}
@@ -86,8 +86,6 @@ namespace big
8686
private:
8787
static constexpr ped_item empty_ped{};
8888
static constexpr vehicle_item empty_vehicle{};
89-
static constexpr weapon_item empty_weapon{};
90-
static constexpr weapon_component empty_component{};
9189
};
9290

9391
inline gta_data_service g_gta_data_service{};

src/services/gta_data/weapon_component.hpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,14 @@
22

33
namespace big
44
{
5-
class weapon_component
5+
class weapon_component final
66
{
77
public:
88
std::string m_name;
99
Hash m_hash;
1010
std::string m_display_name;
1111
std::string m_display_desc;
12-
};
1312

14-
class weapon_component_parsed : public weapon_component
15-
{
1613
NLOHMANN_DEFINE_TYPE_INTRUSIVE(weapon_component, m_name, m_hash, m_display_name, m_display_desc)
1714
};
1815
}

src/services/gta_data/weapon_file.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ namespace big
1717
NLOHMANN_DEFINE_TYPE_INTRUSIVE(version_info, m_game_build, m_online_version, m_file_version)
1818
} version_info{};
1919

20-
std::map<std::string, weapon_item_parsed> weapon_map;
21-
std::map<std::string, weapon_component_parsed> weapon_components;
20+
std::map<std::string, weapon_item> weapon_map;
21+
std::map<std::string, weapon_component> weapon_components;
2222

2323
NLOHMANN_DEFINE_TYPE_INTRUSIVE(weapon_file, version_info, weapon_map, weapon_components)
2424

src/services/gta_data/weapon_item.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ namespace big
2222
uint32_t m_reward_ammo_hash;
2323
std::vector<std::string> m_attachments;
2424
bool m_throwable;
25+
26+
NLOHMANN_DEFINE_TYPE_INTRUSIVE(weapon_item, m_name, m_display_name, m_weapon_type, m_hash, m_reward_hash, m_reward_ammo_hash, m_attachments, m_throwable)
2527
};
2628

2729
class weapon_item_parsed : public weapon_item
2830
{
2931
public:
3032
RPFDatafileSource rpf_file_type = RPFDatafileSource::UNKNOWN;
31-
32-
NLOHMANN_DEFINE_TYPE_INTRUSIVE(weapon_item, m_name, m_display_name, m_weapon_type, m_hash, m_reward_hash, m_reward_ammo_hash, m_attachments, m_throwable)
3333
};
3434
}

0 commit comments

Comments
 (0)