Add hysteresis to depot search max penalty in missing depot order mode
See: #345
This commit is contained in:
@@ -6565,9 +6565,9 @@ static void CheckIfTrainNeedsService(Train *v)
|
||||
default: NOT_REACHED();
|
||||
}
|
||||
|
||||
FindDepotData tfdd = FindClosestTrainDepot(v, max_penalty);
|
||||
FindDepotData tfdd = FindClosestTrainDepot(v, max_penalty * (v->current_order.IsType(OT_GOTO_DEPOT) ? 2 : 1));
|
||||
/* Only go to the depot if it is not too far out of our way. */
|
||||
if (tfdd.best_length == UINT_MAX || tfdd.best_length > max_penalty) {
|
||||
if (tfdd.best_length == UINT_MAX || tfdd.best_length > max_penalty * (v->current_order.IsType(OT_GOTO_DEPOT) && v->current_order.GetDestination() == GetDepotIndex(tfdd.tile) ? 2 : 1)) {
|
||||
if (v->current_order.IsType(OT_GOTO_DEPOT)) {
|
||||
/* If we were already heading for a depot but it has
|
||||
* suddenly moved farther away, we continue our normal
|
||||
|
Reference in New Issue
Block a user