From 53b92106ff29b9257725a39bad41e1846923ae22 Mon Sep 17 00:00:00 2001 From: Lynix Date: Fri, 21 Apr 2017 01:02:23 +0200 Subject: [PATCH] Sdk/World: Fix block pointers --- SDK/src/NDK/World.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/SDK/src/NDK/World.cpp b/SDK/src/NDK/World.cpp index db3cef529..3daf21e06 100644 --- a/SDK/src/NDK/World.cpp +++ b/SDK/src/NDK/World.cpp @@ -73,7 +73,7 @@ namespace Ndk else { // We allocate a new entity - id = static_cast(m_entities.size()); + id = static_cast(m_entityBlocks.size()); if (m_entities.capacity() > m_entities.size()) { @@ -205,6 +205,10 @@ namespace Ndk m_entities.push_back(std::move(*blockPtr)); m_waitingEntities.clear(); + + // Update entity blocks pointers + for (std::size_t i = 0; i < m_entities.size(); ++i) + m_entityBlocks[i] = &m_entities[i]; } // Handle killed entities before last call