Fixed disappearing blocks / Unit tech tree entries
This commit is contained in:
@@ -32,7 +32,7 @@ public class EntityGroup<T extends Entityc> implements Iterable<T>{
|
||||
|
||||
/** Makes sure the next ID counter is higher than this number, so future entities cannot possibly use this ID. */
|
||||
public static void checkNextId(int id){
|
||||
lastId = id + 1;
|
||||
lastId = Math.max(lastId, id + 1);
|
||||
}
|
||||
|
||||
public EntityGroup(Class<T> type, boolean spatial, boolean mapping){
|
||||
@@ -47,6 +47,18 @@ public class EntityGroup<T extends Entityc> implements Iterable<T>{
|
||||
}
|
||||
}
|
||||
|
||||
/** @return entities with colliding IDs, or an empty array. */
|
||||
public Seq<T> checkIDCollisions(){
|
||||
Seq<T> out = new Seq<>();
|
||||
IntSet ints = new IntSet();
|
||||
each(u -> {
|
||||
if(!ints.add(u.id())){
|
||||
out.add(u);
|
||||
}
|
||||
});
|
||||
return out;
|
||||
}
|
||||
|
||||
public void sort(Comparator<? super T> comp){
|
||||
array.sort(comp);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user