Fixed to meet tests
This commit is contained in:
parent
22a75f5559
commit
0b3553d46e
@ -34,9 +34,11 @@ class ComponentArray{
|
||||
*/
|
||||
protected Object getData(int entity){
|
||||
try{
|
||||
Object result = componentArray.get(entityComponentDataMap.get(entity));
|
||||
if (result == null) ECS.writeErr("Attempted to retrieve non-existent data");
|
||||
return result;
|
||||
return componentArray.get(entityComponentDataMap.get(entity));
|
||||
}
|
||||
catch (NullPointerException ex){
|
||||
ECS.writeErr("Attempted to retrieve non-existent data");
|
||||
return null;
|
||||
}
|
||||
catch (IndexOutOfBoundsException e){
|
||||
ECS.writeErr("Index out-of-bounds");
|
||||
|
@ -101,7 +101,7 @@ class ComponentManager{
|
||||
while (result != -1){
|
||||
Type key = indexComponentType.get(result);
|
||||
componentArrays.get(key).moveData(sourceEntity, destinationEntity);
|
||||
sourceRegistrations.nextSetBit(result);
|
||||
result = sourceRegistrations.nextSetBit(result+1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,6 +145,10 @@ class EntityManager{
|
||||
entityRegistrations.get(entity).clear(component);
|
||||
return true;
|
||||
}
|
||||
catch (NullPointerException e){
|
||||
ECS.writeErr("Entity not initialised");
|
||||
return false;
|
||||
}
|
||||
catch (IndexOutOfBoundsException e)
|
||||
{
|
||||
return false;
|
||||
@ -187,7 +191,6 @@ class EntityManager{
|
||||
systemManager.entityRegistrationsChanged(newPos, getRegistrations(newPos));
|
||||
// Invoke the change in the components
|
||||
componentManager.moveAllComponentData(integer, newPos, getRegistrations(integer));
|
||||
componentManager.entityDestroyed(integer);
|
||||
}
|
||||
for (int i = newSize; i < maxSize; i++) {
|
||||
// Remove out-of-bounds data
|
||||
|
Loading…
x
Reference in New Issue
Block a user