Bug fixes with category generation
This commit is contained in:
parent
23bf437bff
commit
086c790a2a
@ -282,11 +282,15 @@ void Ped::Draw()
|
|||||||
if (ImGui::InputInt("Health", &m_SpawnPed::m_nPedHealth))
|
if (ImGui::InputInt("Health", &m_SpawnPed::m_nPedHealth))
|
||||||
{
|
{
|
||||||
if (m_SpawnPed::m_nPedHealth > 1000)
|
if (m_SpawnPed::m_nPedHealth > 1000)
|
||||||
|
{
|
||||||
m_SpawnPed::m_nPedHealth = 1000;
|
m_SpawnPed::m_nPedHealth = 1000;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_SpawnPed::m_nPedHealth < 0)
|
if (m_SpawnPed::m_nPedHealth < 0)
|
||||||
|
{
|
||||||
m_SpawnPed::m_nPedHealth = 0;
|
m_SpawnPed::m_nPedHealth = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Ui::ListBox("Ped type", m_SpawnPed::m_PedTypeList, m_SpawnPed::m_nSelectedPedType);
|
Ui::ListBox("Ped type", m_SpawnPed::m_PedTypeList, m_SpawnPed::m_nSelectedPedType);
|
||||||
#ifdef GTASA
|
#ifdef GTASA
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
|
@ -5,7 +5,23 @@
|
|||||||
ResourceStore::ResourceStore(const char* text, eResourceType type, ImVec2 imageSize)
|
ResourceStore::ResourceStore(const char* text, eResourceType type, ImVec2 imageSize)
|
||||||
: m_ImageSize(imageSize)
|
: m_ImageSize(imageSize)
|
||||||
{
|
{
|
||||||
if (type != eResourceType::TYPE_TEXT)
|
if (type == eResourceType::TYPE_TEXT
|
||||||
|
|| type == eResourceType::TYPE_BOTH)
|
||||||
|
{
|
||||||
|
m_pJson = std::make_unique<CJson>(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
|
Textures need to be loaded from main thread
|
||||||
@ -19,22 +35,6 @@ ResourceStore::ResourceStore(const char* text, eResourceType type, ImVec2 imageS
|
|||||||
m_bTexturesLoaded = true;
|
m_bTexturesLoaded = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (type == eResourceType::TYPE_BOTH)
|
|
||||||
{
|
|
||||||
goto loadJson;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
loadJson:
|
|
||||||
m_pJson = std::make_unique<CJson>(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`
|
// Naming format in Txd `Category$TextureName`
|
||||||
std::stringstream ss(pTex->name);
|
std::stringstream ss(pTex->name);
|
||||||
std::string str;
|
std::string str;
|
||||||
|
|
||||||
getline(ss, str, '$');
|
getline(ss, str, '$');
|
||||||
m_ImagesList.back().get()->m_CategoryName = str;
|
m_ImagesList.back().get()->m_CategoryName = str;
|
||||||
|
|
||||||
@ -83,10 +84,9 @@ void ResourceStore::LoadTextureResource(std::string&& name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Genereate categories
|
// Genereate categories
|
||||||
std::string itemNames;
|
if (!std::count(m_Categories.begin(), m_Categories.end(), m_ImagesList.back().get()->m_CategoryName))
|
||||||
if (!std::count(m_Categories.begin(), m_Categories.end(), itemNames))
|
|
||||||
{
|
{
|
||||||
m_Categories.push_back(itemNames);
|
m_Categories.push_back(m_ImagesList.back().get()->m_CategoryName);
|
||||||
}
|
}
|
||||||
pRLL = (RwLinkList*)pEndDic;
|
pRLL = (RwLinkList*)pEndDic;
|
||||||
}
|
}
|
||||||
|
@ -193,10 +193,6 @@ Vehicle::Vehicle()
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
Vehicle::~Vehicle()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef GTASA
|
#ifdef GTASA
|
||||||
void Vehicle::AddComponent(const std::string& component, const bool display_message)
|
void Vehicle::AddComponent(const std::string& component, const bool display_message)
|
||||||
{
|
{
|
||||||
|
@ -107,5 +107,4 @@ public:
|
|||||||
static int GetModelFromName(const char* name);
|
static int GetModelFromName(const char* name);
|
||||||
static void Draw();
|
static void Draw();
|
||||||
Vehicle();
|
Vehicle();
|
||||||
~Vehicle();
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user