diff options
author | rubidium <rubidium@openttd.org> | 2009-12-13 10:48:44 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-12-13 10:48:44 +0000 |
commit | 472e5501fa99b9db5c1ebccadf929e56e59fefdd (patch) | |
tree | 168696f40e69790495f936179cfa332faea5c3f7 /src/ship_cmd.cpp | |
parent | 3cfcae07e2732a11005da79dc0a113b22d83951b (diff) | |
download | openttd-472e5501fa99b9db5c1ebccadf929e56e59fefdd.tar.xz |
(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.
Diffstat (limited to 'src/ship_cmd.cpp')
-rw-r--r-- | src/ship_cmd.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
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); |