MAJOR BREAKING CHANGE: EntityID 0 is now a valid entity. Use EntityID_Invalid as sentry for checks!
Also contains inseparable editor changes.
This commit is contained in:
@@ -10,12 +10,12 @@ World::~World()
|
||||
EntityID World::CreateEntity(EntityID parent /*= 0*/)
|
||||
{
|
||||
EntityID newEntity = generateEntityID();
|
||||
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);
|
||||
if (newEntity == parent) {
|
||||
LOG_WARNING("Invalid parent #%i of Entity#%i", newEntity, parent);
|
||||
parent = EntityID_Invalid;
|
||||
}
|
||||
m_EntityParents[newEntity] = parent;
|
||||
m_EntityChildren.insert(std::make_pair(parent, newEntity));
|
||||
return newEntity;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user