Fixed weird behavior when components would register multiple times (Hint: It should never happen in the first place)
This commit is contained in:
@@ -53,7 +53,9 @@ void World::DeleteEntity(EntityID entity)
|
|||||||
|
|
||||||
void World::RegisterComponent(ComponentInfo& ci)
|
void World::RegisterComponent(ComponentInfo& ci)
|
||||||
{
|
{
|
||||||
m_ComponentPools[ci.Name] = new ComponentPool(ci);
|
if (m_ComponentPools.find(ci.Name) == m_ComponentPools.end()) {
|
||||||
|
m_ComponentPools[ci.Name] = new ComponentPool(ci);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ComponentWrapper World::AttachComponent(EntityID entity, std::string componentType)
|
ComponentWrapper World::AttachComponent(EntityID entity, std::string componentType)
|
||||||
|
|||||||
@@ -662,8 +662,8 @@ void EditorSystem::fileImport(World* world)
|
|||||||
{
|
{
|
||||||
m_CurrentFile = openDialog(m_DefaultEntityDir);
|
m_CurrentFile = openDialog(m_DefaultEntityDir);
|
||||||
auto file = ResourceManager::Load<EntityFile>(m_CurrentFile.string());
|
auto file = ResourceManager::Load<EntityFile>(m_CurrentFile.string());
|
||||||
//EntityFilePreprocessor fpp(file);
|
EntityFilePreprocessor fpp(file);
|
||||||
//fpp.RegisterComponents(world);
|
fpp.RegisterComponents(world);
|
||||||
EntityFileParser fp(file);
|
EntityFileParser fp(file);
|
||||||
fp.MergeEntities(world);
|
fp.MergeEntities(world);
|
||||||
createWidget();
|
createWidget();
|
||||||
|
|||||||
+2
-2
@@ -52,8 +52,8 @@ Game::Game(int argc, char* argv[])
|
|||||||
auto file = ResourceManager::Load<EntityFile>(mapToLoad);
|
auto file = ResourceManager::Load<EntityFile>(mapToLoad);
|
||||||
EntityFilePreprocessor fpp(file);
|
EntityFilePreprocessor fpp(file);
|
||||||
fpp.RegisterComponents(m_World);
|
fpp.RegisterComponents(m_World);
|
||||||
//EntityFileParser fp(file);
|
EntityFileParser fp(file);
|
||||||
//fp.MergeEntities(m_World);
|
fp.MergeEntities(m_World);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create system pipeline
|
// Create system pipeline
|
||||||
|
|||||||
Reference in New Issue
Block a user