Fixed multiple crashes, fixed version mismatch showing as disconnect

This commit is contained in:
Anuken
2018-01-26 00:36:23 -05:00
parent 6abbc3eca7
commit 493af5e653
10 changed files with 30 additions and 21 deletions
+16 -8
View File
@@ -122,6 +122,10 @@ public class Pathfind{
//go through each spawnpoint, and if it's not found a path yet, update it
for(SpawnPoint point : Vars.control.getSpawnPoints()){
if(point.request == null){
resetPathFor(point);
}
if(!point.request.pathFound){
try{
if(point.finder.search(point.request, maxTime)){
@@ -161,17 +165,21 @@ public class Pathfind{
/**Reset and clear the paths.*/
public void resetPaths(){
for(SpawnPoint point : Vars.control.getSpawnPoints()){
point.finder = new OptimizedPathFinder<>(graph);
point.path.clear();
point.pathTiles = null;
point.request = new PathFinderRequest<>(point.start, Vars.control.getCore(), Vars.control.getDifficulty().heuristic, point.path);
point.request.statusChanged = true; //IMPORTANT!
resetPathFor(point);
}
}
private void resetPathFor(SpawnPoint point){
point.finder = new OptimizedPathFinder<>(graph);
point.path.clear();
point.pathTiles = null;
point.request = new PathFinderRequest<>(point.start, Vars.control.getCore(), Vars.control.getDifficulty().heuristic, point.path);
point.request.statusChanged = true; //IMPORTANT!
}
/**For an enemy that was just loaded from a save, find the node in the path it should be following.*/
void findNode(Enemy enemy){
if(enemy.lane >= Vars.control.getSpawnPoints().size || enemy.lane < 0){