@Override public boolean finalizeSearch (long timeToRun) { if (statusChanged) { if (PathFinderRequestControl.DEBUG) System.out.println("MyPathFinderRequest.finalizeSearch[" + pathIndex + "]: statusChanged **********************************"); pathSmootherRequest.refresh(paths[pathIndex]); smoothFinished = false; if (pathFound) { HierarchicalTiledNode l1Start = worldMap.convertNodeBetweenLevels(0, startNode, 1); SmoothableGraphPath<HierarchicalTiledNode, Vector2> path = paths[pathIndex]; int nodeCount = path.getCount(); if (nodeCount > 0 && endNode != path.get(nodeCount - 1)) { for (int i = 1; i < nodeCount; i++) { if (worldMap.convertNodeBetweenLevels(0, path.get(i), 1) != l1Start) { path.truncatePath(i + 1); break; } } } } } if (pathFound) { if (PathFinderRequestControl.DEBUG) System.out.println("MyPathFinderRequest.finalizeSearch[" + pathIndex + "]: pathFound **********************************"); if (smooth && !smoothFinished) { worldMap.setLevel(0); smoothFinished = pathSmoother.smoothPath(pathSmootherRequest, timeToRun); if (!smoothFinished) return false; } numPaths = pathIndex + 1; } return true; }