diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp index 9b30db2c6f..711784d5b0 100644 --- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -2194,9 +2194,9 @@ static void CheckIfRoadVehNeedsService(RoadVehicle *v) default: NOT_REACHED(); } - FindDepotData rfdd = FindClosestRoadDepot(v, max_penalty); + FindDepotData rfdd = FindClosestRoadDepot(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 (rfdd.best_length == UINT_MAX || rfdd.best_length > max_penalty) { + if (rfdd.best_length == UINT_MAX || rfdd.best_length > max_penalty * (v->current_order.IsType(OT_GOTO_DEPOT) && v->current_order.GetDestination() == GetDepotIndex(rfdd.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 diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index f2511c0378..f82da280e0 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -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