Optimize navigation refresh

This commit is contained in:
Timo van Veen 2023-10-24 22:04:29 +02:00
parent 67ebc8a2c6
commit 57fbe3cb48
2 changed files with 4 additions and 6 deletions

View file

@ -443,7 +443,7 @@ public class Navigation {
TrackGraph graph = train.graph;
if (graph == null)
return null;
LogUtils.getLogger().info("finding path");
Couple<DiscoveredPath> results = Couple.create(null, null);
for (boolean forward : Iterate.trueAndFalse) {

View file

@ -541,14 +541,12 @@ public class Train {
if (!reservedSignalBlocks.isEmpty())
return;
GlobalStation destination = navigation.destination;
if (!navigatingManually && fullRefresh) {
DiscoveredPath preferredPath = runtime.startCurrentInstruction();
if (preferredPath != null)
destination = preferredPath.destination;
if (preferredPath != null){
navigation.startNavigation(preferredPath);
}
}
navigation.startNavigation(navigation.findPathTo(destination, navigatingManually ? -1 : Double.MAX_VALUE));
}
private void tickDerailedSlowdown() {