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:
2016-01-11 10:26:45 +01:00
parent 6adc98eea5
commit 39dd27726d
9 changed files with 238 additions and 118 deletions
+5 -5
View File
@@ -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;
}