From af8fc118b77feee189a71831536b098ab8c6d181 Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Thu, 15 Oct 2015 12:45:03 +0200 Subject: [PATCH] World initialization refactored to register system components and resources BEFORE initializing them all because apparently we create entities in system initialization functions now and need all components to be registered and available. --- src/game/Core/World.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/game/Core/World.cpp b/src/game/Core/World.cpp index f0f7e8c..ebd7925 100644 --- a/src/game/Core/World.cpp +++ b/src/game/Core/World.cpp @@ -154,12 +154,14 @@ void dd::World::Initialize() { RegisterSystems(); AddSystems(); - for (auto pair : m_Systems) - { - auto system = pair.second; - system->RegisterComponents(&ComponentFactory); - system->RegisterResourceTypes(ResourceManager); - system->Initialize(); + for (auto pair : m_Systems) { + pair.second->RegisterComponents(&ComponentFactory); + } + for (auto pair : m_Systems) { + pair.second->RegisterResourceTypes(ResourceManager); + } + for (auto pair : m_Systems) { + pair.second->Initialize(); } }