Tests added, some function changes
Functions changed to return booleans
This commit is contained in:
parent
b1efb9802d
commit
23abf57b6e
@ -17,13 +17,14 @@ class ComponentManager{
|
|||||||
Map<Type, Integer> componentPosIndex = new HashMap<>();
|
Map<Type, Integer> componentPosIndex = new HashMap<>();
|
||||||
int componentPos = 0;
|
int componentPos = 0;
|
||||||
|
|
||||||
public void registerComponent(Type type){
|
public boolean registerComponent(Type type){
|
||||||
if (componentArrays.containsKey(type)){
|
if (componentArrays.containsKey(type)){
|
||||||
System.err.println("Component " + type.getTypeName() + " is already registered");
|
ECS.writeErr("Component " + type.getTypeName() + " is already registered");
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
componentArrays.put(type, new ComponentArray());
|
componentArrays.put(type, new ComponentArray());
|
||||||
componentPosIndex.put(type, componentPos++);
|
componentPosIndex.put(type, componentPos++);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addComponentToEntity(Type componentName, Object componentData, int entity){
|
public void addComponentToEntity(Type componentName, Object componentData, int entity){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user