Fixed #2066
This commit is contained in:
@@ -1,16 +1,15 @@
|
||||
package mindustry.async;
|
||||
|
||||
import arc.math.geom.*;
|
||||
import arc.struct.*;
|
||||
import mindustry.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.game.Teams.*;
|
||||
import mindustry.gen.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/** Creates quadtrees per unit team. */
|
||||
public class TeamIndexProcess implements AsyncProcess{
|
||||
private QuadTree<Unitc>[] trees = new QuadTree[Team.all().length];
|
||||
private Array<Team> active = new Array<>();
|
||||
private int[] counts = new int[Team.all().length];
|
||||
|
||||
public QuadTree<Unitc> tree(Team team){
|
||||
@@ -29,28 +28,20 @@ public class TeamIndexProcess implements AsyncProcess{
|
||||
|
||||
@Override
|
||||
public void reset(){
|
||||
active.clear();
|
||||
counts = new int[Team.all().length];
|
||||
trees = new QuadTree[Team.all().length];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void begin(){
|
||||
for(TeamData data : Vars.state.teams.getActive()){
|
||||
if(!active.contains(data.team)){
|
||||
active.add(data.team);
|
||||
}
|
||||
}
|
||||
|
||||
for(Team team : active){
|
||||
for(Team team : Team.all()){
|
||||
if(trees[team.uid] != null){
|
||||
trees[team.uid].clear();
|
||||
}
|
||||
}
|
||||
|
||||
for(Team team : active){
|
||||
counts[team.id] = 0;
|
||||
}
|
||||
Arrays.fill(counts, 0);
|
||||
|
||||
for(Unitc unit : Groups.unit){
|
||||
tree(unit.team()).insert(unit);
|
||||
|
||||
Reference in New Issue
Block a user