mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-11 00:07:46 +07:00
crashfix
This commit is contained in:
@ -1,5 +1,6 @@
|
|||||||
package io.anuke.mindustry.game;
|
package io.anuke.mindustry.game;
|
||||||
|
|
||||||
|
import io.anuke.arc.collection.Array;
|
||||||
import io.anuke.arc.collection.EnumSet;
|
import io.anuke.arc.collection.EnumSet;
|
||||||
import io.anuke.arc.collection.ObjectSet;
|
import io.anuke.arc.collection.ObjectSet;
|
||||||
import io.anuke.mindustry.Vars;
|
import io.anuke.mindustry.Vars;
|
||||||
@ -22,13 +23,7 @@ public class Teams{
|
|||||||
/**Returns team data by type.*/
|
/**Returns team data by type.*/
|
||||||
public TeamData get(Team team){
|
public TeamData get(Team team){
|
||||||
if(map[team.ordinal()] == null){
|
if(map[team.ordinal()] == null){
|
||||||
//By default, a non-defined team will be enemies of everything.
|
add(team, Array.with(Team.all).select(t -> t != team && t != Team.none && team != Team.none).toArray(Team.class));
|
||||||
//neutral teams (none) do not have any enemies.
|
|
||||||
Team[] others = new Team[Team.all.length-1];
|
|
||||||
for(int i = 0, j = 0; i < Team.all.length; i++){
|
|
||||||
if(Team.all[i] != team && team != Team.none && Team.all[i] != Team.none) others[j++] = Team.all[i];
|
|
||||||
}
|
|
||||||
add(team, others);
|
|
||||||
}
|
}
|
||||||
return map[team.ordinal()];
|
return map[team.ordinal()];
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user