From 472e5501fa99b9db5c1ebccadf929e56e59fefdd Mon Sep 17 00:00:00 2001 From: rubidium Date: Sun, 13 Dec 2009 10:48:44 +0000 Subject: (svn r18481) -Codechange: unify the curve pathfinder penalty defaults; 0.01 tile won't make a dent, 3 tiles might be a bit too much -Feature-ish: make maximum pathfinder penalties for finding depots customisable, also increase it slightly to 20 tiles worth of penalties. --- src/ship_cmd.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/ship_cmd.cpp') diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp index 730c521b8..9bc96ab88 100644 --- a/src/ship_cmd.cpp +++ b/src/ship_cmd.cpp @@ -126,9 +126,17 @@ static void CheckIfShipNeedsService(Vehicle *v) return; } + uint max_distance; + switch (_settings_game.pf.pathfinder_for_ships) { + case VPF_OPF: max_distance = 12; break; + case VPF_NPF: max_distance = _settings_game.pf.npf.maximum_go_to_depot_penalty / NPF_TILE_LENGTH; break; + case VPF_YAPF: max_distance = _settings_game.pf.yapf.maximum_go_to_depot_penalty / YAPF_TILE_LENGTH; break; + default: NOT_REACHED(); + } + const Depot *depot = FindClosestShipDepot(v); - if (depot == NULL || DistanceManhattan(v->tile, depot->xy) > 12) { + if (depot == NULL || DistanceManhattan(v->tile, depot->xy) > max_distance) { if (v->current_order.IsType(OT_GOTO_DEPOT)) { v->current_order.MakeDummy(); SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); -- cgit v1.2.3-54-g00ecf