apotapov / gdx-artemis

Fork of artemis entity-system (http://gamadu.com/artemis/) refactored to integrate with Libgdx (http://libgdx.badlogicgames.com/)
Other
53 stars 5 forks source link

Bug in component manager #32

Closed apotapov closed 10 years ago

apotapov commented 10 years ago

Per @Noir707

Reading the ComponentManager class at line 100 I saw this: [...] Component current = components.get(e.id); if (current != null && current != component) { Pools.free(current); } else { components.set(e.id, component); } e.getComponentBits().set(classIndex); [...]

I think it should be something like [...] Component current = components.get(e.id); if (current != null && current != component) { Pools.free(current); } components.set(e.id, component); e.getComponentBits().set(classIndex); [...] because you want to free the current allocated component and put the new one in the Array.