Copy constructor for deep copy of World.

This commit is contained in:
2016-02-18 13:54:32 +01:00
parent 97499f1c28
commit ca907b912e
2 changed files with 10 additions and 0 deletions
+1
View File
@@ -15,6 +15,7 @@ public:
: m_EventBroker(eventBroker)
{ }
~World();
World(const World& other);
// Create empty entity
EntityID CreateEntity(EntityID parent = 0);
+9
View File
@@ -9,6 +9,15 @@ World::~World()
}
}
World::World(const World& other)
: m_EventBroker(other.m_EventBroker)
{
// Deep copy component pools
for (auto& kv : m_ComponentPools) {
m_ComponentPools[kv.first] = new ComponentPool(*kv.second);
}
}
EntityID World::CreateEntity(EntityID parent /*= 0*/)
{
EntityID newEntity = generateEntityID();