Created World::Merge which will merge a world into another one

This commit is contained in:
2016-03-02 18:38:49 +01:00
parent 76117cb3ce
commit 62c8196ad4
2 changed files with 44 additions and 3 deletions
+6 -2
View File
@@ -19,13 +19,13 @@ public:
World(const World& other);
// Create empty entity
EntityID CreateEntity(EntityID parent = 0);
EntityID CreateEntity(EntityID parent = EntityID_Invalid);
// Delete entity and all components within
void DeleteEntity(EntityID entity);
// Check if an entity exists
bool ValidEntity(EntityID entity) const;
// Register a component type and allocate space for it
void RegisterComponent(ComponentInfo& ci);
void RegisterComponent(const ComponentInfo& ci);
// Attach a component to an entity and fill it with default values
ComponentWrapper AttachComponent(EntityID entity, const std::string& componentType);
// Check if an entity has a component
@@ -53,6 +53,10 @@ public:
// Get the first entity in the world with the name.
EntityWrapper GetFirstEntityByName(const std::string& name);
// Merge another world into this one
// Returns a map that maps entities from the other world to their copies in this one
std::unordered_map<EntityID, EntityID> Merge(World& other);
private:
EventBroker* m_EventBroker = nullptr;
EntityID m_CurrentEntityID = 0;