Merge branch 'unsector'
# Conflicts: # core/src/io/anuke/mindustry/maps/SectorPresets.java # core/src/io/anuke/mindustry/maps/Sectors.java # core/src/io/anuke/mindustry/maps/TutorialSector.java # core/src/io/anuke/mindustry/maps/generation/FortressGenerator.java # core/src/io/anuke/mindustry/maps/missions/MissionWithStartingCore.java # core/src/io/anuke/mindustry/world/blocks/storage/CoreBlock.java
This commit is contained in:
@@ -93,7 +93,7 @@ public class Pathfinder{
|
||||
* This only occurs for active teams.*/
|
||||
private void update(Tile tile, Team team){
|
||||
//make sure team exists
|
||||
if(paths[team.ordinal()] != null){
|
||||
if(paths[team.ordinal()] != null && paths[team.ordinal()].weights != null){
|
||||
PathData path = paths[team.ordinal()];
|
||||
|
||||
//impassable tiles have a weight of float.max
|
||||
@@ -109,7 +109,7 @@ public class Pathfinder{
|
||||
//add all targets to the frontier
|
||||
for(Tile other : world.indexer.getEnemy(team, BlockFlag.target)){
|
||||
path.weights[other.x][other.y] = 0;
|
||||
path.searches[other.x][other.y] = path.search;
|
||||
path.searches[other.x][other.y] = (short)path.search;
|
||||
path.frontier.addFirst(other);
|
||||
}
|
||||
}
|
||||
@@ -117,6 +117,8 @@ public class Pathfinder{
|
||||
|
||||
private void createFor(Team team){
|
||||
PathData path = new PathData();
|
||||
path.weights = new float[world.width()][world.height()];
|
||||
path.searches = new short[world.width()][world.height()];
|
||||
path.search++;
|
||||
path.frontier.ensureCapacity((world.width() + world.height()) * 3);
|
||||
|
||||
@@ -130,7 +132,7 @@ public class Pathfinder{
|
||||
&& tile.block().flags.contains(BlockFlag.target)){
|
||||
path.frontier.addFirst(tile);
|
||||
path.weights[x][y] = 0;
|
||||
path.searches[x][y] = path.search;
|
||||
path.searches[x][y] = (short)path.search;
|
||||
}else{
|
||||
path.weights[x][y] = Float.MAX_VALUE;
|
||||
}
|
||||
@@ -159,7 +161,7 @@ public class Pathfinder{
|
||||
&& passable(other, team)){
|
||||
path.frontier.addFirst(world.tile(dx, dy));
|
||||
path.weights[dx][dy] = cost + other.cost;
|
||||
path.searches[dx][dy] = path.search;
|
||||
path.searches[dx][dy] = (short)path.search;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -186,14 +188,9 @@ public class Pathfinder{
|
||||
|
||||
class PathData{
|
||||
float[][] weights;
|
||||
int[][] searches;
|
||||
short[][] searches;
|
||||
int search = 0;
|
||||
long lastSearchTime;
|
||||
Queue<Tile> frontier = new Queue<>();
|
||||
|
||||
PathData(){
|
||||
weights = new float[world.width()][world.height()];
|
||||
searches = new int[world.width()][world.height()];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,12 +177,7 @@ public class WaveSpawner{
|
||||
flySpawns.clear();
|
||||
groundSpawns.clear();
|
||||
quadrants = new GridBits(quadWidth(), quadHeight());
|
||||
|
||||
if(world.getSector() == null){
|
||||
groups = Waves.getSpawns();
|
||||
}else{
|
||||
groups = world.getSector().spawns;
|
||||
}
|
||||
groups = Waves.getSpawns();
|
||||
|
||||
dynamicSpawn = true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user