(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.
This commit is contained in:
rubidium
2009-12-13 10:48:44 +00:00
parent d4451d13a0
commit 899b3db66b
11 changed files with 65 additions and 44 deletions

View File

@@ -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);