reinstate proper static cutoff behavior

This commit is contained in:
Leijurv 2018-12-03 14:08:44 -08:00
parent 58a5720b6b
commit 8e2df3a030
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A

View File

@ -39,14 +39,15 @@ public abstract class PathBase implements IPath {
@Override
public PathBase staticCutoff(Goal destination) {
if (length() < BaritoneAPI.getSettings().pathCutoffMinimumLength.get()) {
int min = BaritoneAPI.getSettings().pathCutoffMinimumLength.get();
if (length() < min) {
return this;
}
if (destination == null || destination.isInGoal(getDest())) {
return this;
}
double factor = BaritoneAPI.getSettings().pathCutoffFactor.get();
int newLength = (int) ((length() - 1) * factor);
int newLength = (int) ((length() - 1) * factor) + min;
return new CutoffPath(this, newLength);
}
}