diff --git a/src/Ped.cpp b/src/Ped.cpp index b7dd366..082544c 100644 --- a/src/Ped.cpp +++ b/src/Ped.cpp @@ -282,10 +282,14 @@ void Ped::Draw() if (ImGui::InputInt("Health", &m_SpawnPed::m_nPedHealth)) { if (m_SpawnPed::m_nPedHealth > 1000) + { m_SpawnPed::m_nPedHealth = 1000; + } if (m_SpawnPed::m_nPedHealth < 0) + { m_SpawnPed::m_nPedHealth = 0; + } } Ui::ListBox("Ped type", m_SpawnPed::m_PedTypeList, m_SpawnPed::m_nSelectedPedType); #ifdef GTASA diff --git a/src/ResourceStore.cpp b/src/ResourceStore.cpp index 23d808f..453a268 100644 --- a/src/ResourceStore.cpp +++ b/src/ResourceStore.cpp @@ -5,7 +5,23 @@ ResourceStore::ResourceStore(const char* text, eResourceType type, ImVec2 imageSize) : m_ImageSize(imageSize) { - if (type != eResourceType::TYPE_TEXT) + if (type == eResourceType::TYPE_TEXT + || type == eResourceType::TYPE_BOTH) + { + m_pJson = std::make_unique(text); + + if (type == eResourceType::TYPE_TEXT) + { + // Generate categories + for (auto element : m_pJson->m_Data.items()) + { + m_Categories.push_back(element.key()); + } + } + } + + if (type == eResourceType::TYPE_IMAGE + || type == eResourceType::TYPE_BOTH) { /* Textures need to be loaded from main thread @@ -19,22 +35,6 @@ ResourceStore::ResourceStore(const char* text, eResourceType type, ImVec2 imageS m_bTexturesLoaded = true; } }; - - if (type == eResourceType::TYPE_BOTH) - { - goto loadJson; - } - } - else - { - loadJson: - m_pJson = std::make_unique(text); - - // Generate categories - for (auto element : m_pJson->m_Data.items()) - { - m_Categories.push_back(element.key()); - } } } @@ -68,6 +68,7 @@ void ResourceStore::LoadTextureResource(std::string&& name) // Naming format in Txd `Category$TextureName` std::stringstream ss(pTex->name); std::string str; + getline(ss, str, '$'); m_ImagesList.back().get()->m_CategoryName = str; @@ -83,10 +84,9 @@ void ResourceStore::LoadTextureResource(std::string&& name) } // Genereate categories - std::string itemNames; - if (!std::count(m_Categories.begin(), m_Categories.end(), itemNames)) + if (!std::count(m_Categories.begin(), m_Categories.end(), m_ImagesList.back().get()->m_CategoryName)) { - m_Categories.push_back(itemNames); + m_Categories.push_back(m_ImagesList.back().get()->m_CategoryName); } pRLL = (RwLinkList*)pEndDic; } diff --git a/src/Vehicle.cpp b/src/Vehicle.cpp index 68640ad..f73ad62 100644 --- a/src/Vehicle.cpp +++ b/src/Vehicle.cpp @@ -193,10 +193,6 @@ Vehicle::Vehicle() }; } -Vehicle::~Vehicle() -{ -} - #ifdef GTASA void Vehicle::AddComponent(const std::string& component, const bool display_message) { diff --git a/src/Vehicle.h b/src/Vehicle.h index 3facb4f..6390491 100644 --- a/src/Vehicle.h +++ b/src/Vehicle.h @@ -107,5 +107,4 @@ public: static int GetModelFromName(const char* name); static void Draw(); Vehicle(); - ~Vehicle(); };