1
0
Fork 0

Set entity world early

This commit is contained in:
mathiascode 2020-05-03 01:37:35 +03:00 committed by Tiger Wang
parent 0b9b7bc1a8
commit 5f2c572f9a
2 changed files with 1 additions and 1 deletions

View File

@ -154,6 +154,7 @@ bool cEntity::Initialize(OwnedEntity a_Self, cWorld & a_EntityWorld)
ASSERT(m_World == nullptr);
ASSERT(GetParentChunk() == nullptr);
SetWorld(&a_EntityWorld);
a_EntityWorld.AddEntity(std::move(a_Self));
return true;

View File

@ -1024,7 +1024,6 @@ void cWorld::Tick(std::chrono::milliseconds a_Dt, std::chrono::milliseconds a_La
}
for (auto & Entity : EntitiesToAdd)
{
Entity->SetWorld(this);
auto EntityPtr = Entity.get();
m_ChunkMap->AddEntity(std::move(Entity));
EntityPtr->OnAddToWorld(*this);