From 45e855205488d590789fa31f67576af5a930ce4b Mon Sep 17 00:00:00 2001 From: bakpakin Date: Sun, 21 Jun 2015 14:42:03 -0400 Subject: [PATCH] Fix entity count in worlds. --- tiny.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tiny.lua b/tiny.lua index 2452f8c..98d191a 100644 --- a/tiny.lua +++ b/tiny.lua @@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -- @author Calvin Rose -- @license MIT -- @copyright 2015 -local tiny = { _VERSION = "1.1-4" } +local tiny = { _VERSION = "scm" } -- Local versions of standard lua functions local tinsert = table.insert @@ -542,6 +542,7 @@ function tiny_manageEntities(world) entity = e2r[i] if entities[entity] then entities[entity] = nil + entityCount = entityCount - 1 for j = 1, #systems do system = systems[j] @@ -556,7 +557,6 @@ function tiny_manageEntities(world) seis[tmpEntity] = index seis[entity] = nil ses[#ses] = nil - entityCount = entityCount - 1 onRemove = system.onRemove if onRemove then onRemove(system, entity) @@ -574,6 +574,7 @@ function tiny_manageEntities(world) entity = e2a[i] if not entities[entity] then entities[entity] = true + entityCount = entityCount + 1 for j = 1, #systems do system = systems[j] @@ -585,7 +586,6 @@ function tiny_manageEntities(world) index = #ses + 1 ses[index] = entity seis[entity] = index - entityCount = entityCount + 1 onAdd = system.onAdd if onAdd then onAdd(system, entity)