Entity 0 is now a real entity in the world, created by the first entity read while importing. This makes the difference between map files and entity files automatic, since consecutive entity file loads should automatically get the world as parent, as long as the world entity has been created earlier.
This commit is contained in:
@@ -10,12 +10,15 @@ World::~World()
|
||||
EntityID World::CreateEntity(EntityID parent /*= 0*/)
|
||||
{
|
||||
EntityID newEntity = generateEntityID();
|
||||
m_EntityParents[newEntity] = parent;
|
||||
m_EntityChildren.insert(std::make_pair(parent, newEntity));
|
||||
if (newEntity != parent) {
|
||||
m_EntityParents[newEntity] = parent;
|
||||
m_EntityChildren.insert(std::make_pair(parent, newEntity));
|
||||
} else {
|
||||
LOG_WARNING("Attempted to create an entity with itself as parent! Entity#%i with parent #%i", newEntity, parent);
|
||||
}
|
||||
return newEntity;
|
||||
}
|
||||
|
||||
|
||||
void World::DeleteEntity(EntityID entity)
|
||||
{
|
||||
// Delete components
|
||||
|
||||
Reference in New Issue
Block a user