Copy constructor for deep copy of World.
This commit is contained in:
@@ -15,6 +15,7 @@ public:
|
|||||||
: m_EventBroker(eventBroker)
|
: m_EventBroker(eventBroker)
|
||||||
{ }
|
{ }
|
||||||
~World();
|
~World();
|
||||||
|
World(const World& other);
|
||||||
|
|
||||||
// Create empty entity
|
// Create empty entity
|
||||||
EntityID CreateEntity(EntityID parent = 0);
|
EntityID CreateEntity(EntityID parent = 0);
|
||||||
|
|||||||
@@ -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 World::CreateEntity(EntityID parent /*= 0*/)
|
||||||
{
|
{
|
||||||
EntityID newEntity = generateEntityID();
|
EntityID newEntity = generateEntityID();
|
||||||
|
|||||||
Reference in New Issue
Block a user