From 640429a209b1a8edeeb2ccfa7e00b877f3166ce7 Mon Sep 17 00:00:00 2001 From: 4aiman Date: Mon, 26 Oct 2026 21:38:17 +0300 Subject: [PATCH] BRouter trekking: apply adventure penalty in costfactor (was a no-op in initialcost) The ford/grade5/bad-trail penalty sat in the way initialcost and never changed the route cost (verified on the home RouteServer: avoid and adventure gave identical cost). Moved it into costfactor next to town/traffic penalties. Verified against a real ford (47.5387,40.3164): avoid now detours 1.4km->6.2km with fords=0, adventure keeps the 1.4km ford crossing. Node-ford penalty (node initialcost) kept. --- .../src/main/assets/brouter/profiles2/trekking.brf | 14 ++++++++------ tools/brouter-web-staging/profiles2/trekking.brf | 14 ++++++++------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src-tauri/gen/android/app/src/main/assets/brouter/profiles2/trekking.brf b/src-tauri/gen/android/app/src/main/assets/brouter/profiles2/trekking.brf index b4fd21b..45b59f5 100644 --- a/src-tauri/gen/android/app/src/main/assets/brouter/profiles2/trekking.brf +++ b/src-tauri/gen/android/app/src/main/assets/brouter/profiles2/trekking.brf @@ -130,16 +130,17 @@ assign initialclassifier = # this is added to the total cost each time the costfactor # changed # -# Adventure penalty: keep the router off fords, abandoned (grade5) tracks and -# bad/invisible trails unless the rider opts into adventure mode (%allow_adventure%). +# Adventure penalty (added into costfactor below): keep the router off fords, abandoned +# (grade5) tracks and bad/invisible trails unless the rider opts into adventure mode +# (%allow_adventure%). 10000 matches the profile's "excluded way" costfactor. assign adventurepenalty = if allow_adventure then 0 - else add ( if ford=yes|stepping_stones then 100000 else 0 ) - ( if or tracktype=grade5 trail_visibility=bad|horrible|no then 20000 else 0 ) + else add ( if ford=yes|stepping_stones then 10000 else 0 ) + ( if or tracktype=grade5 trail_visibility=bad|horrible|no then 5000 else 0 ) assign initialcost = - add adventurepenalty - ( if ( equal initialclassifier classifier_ferry ) then 10000 else 0 ) + if ( equal initialclassifier classifier_ferry ) then 10000 + else 0 # # implicit access here just from the motorroad tag @@ -306,6 +307,7 @@ assign costfactor add no_river_penalty add noise_penalty add traffic_penalty + add adventurepenalty # # apply oneway-and access-penalties diff --git a/tools/brouter-web-staging/profiles2/trekking.brf b/tools/brouter-web-staging/profiles2/trekking.brf index b4fd21b..45b59f5 100644 --- a/tools/brouter-web-staging/profiles2/trekking.brf +++ b/tools/brouter-web-staging/profiles2/trekking.brf @@ -130,16 +130,17 @@ assign initialclassifier = # this is added to the total cost each time the costfactor # changed # -# Adventure penalty: keep the router off fords, abandoned (grade5) tracks and -# bad/invisible trails unless the rider opts into adventure mode (%allow_adventure%). +# Adventure penalty (added into costfactor below): keep the router off fords, abandoned +# (grade5) tracks and bad/invisible trails unless the rider opts into adventure mode +# (%allow_adventure%). 10000 matches the profile's "excluded way" costfactor. assign adventurepenalty = if allow_adventure then 0 - else add ( if ford=yes|stepping_stones then 100000 else 0 ) - ( if or tracktype=grade5 trail_visibility=bad|horrible|no then 20000 else 0 ) + else add ( if ford=yes|stepping_stones then 10000 else 0 ) + ( if or tracktype=grade5 trail_visibility=bad|horrible|no then 5000 else 0 ) assign initialcost = - add adventurepenalty - ( if ( equal initialclassifier classifier_ferry ) then 10000 else 0 ) + if ( equal initialclassifier classifier_ferry ) then 10000 + else 0 # # implicit access here just from the motorroad tag @@ -306,6 +307,7 @@ assign costfactor add no_river_penalty add noise_penalty add traffic_penalty + add adventurepenalty # # apply oneway-and access-penalties