File tree Expand file tree Collapse file tree 2 files changed +7
-8
lines changed
Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -318,7 +318,7 @@ function way_function(way, result)
318318 }
319319
320320 -- perform an quick initial check and abort if the way is
321- -- obviously not routable.
321+ -- obviously not routable.
322322 -- highway or route tags must be in data table, bridge is optional
323323 if (not data .highway or data .highway == ' ' ) and
324324 (not data .route or data .route == ' ' )
@@ -412,7 +412,7 @@ function turn_function (turn)
412412 if profile .weight_name == ' routability' then
413413 -- penalize turns from non-local access only segments onto local access only tags
414414 if not turn .source_restricted and turn .target_restricted then
415- turn .weight = constants .max_turn_weight
415+ turn .weight = profile .max_turn_weight
416416 end
417417 end
418418end
Original file line number Diff line number Diff line change @@ -401,12 +401,6 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
401401
402402 context.state .script_file (file_name);
403403
404-
405- // set constants in 'constants' table
406- context.state [" constants" ] = context.state .create_table_with (
407- " max_turn_weight" , std::numeric_limits<TurnPenalty>::max ()
408- );
409-
410404 // read properties from 'profile' table
411405 sol::optional<std::string> weight_name = context.state [" profile" ][" weight_name" ];
412406 if ( weight_name != sol::nullopt )
@@ -444,6 +438,11 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
444438 if ( force_split_edges != sol::nullopt )
445439 context.properties .force_split_edges = force_split_edges.value ();
446440
441+ if (auto profile = context.state [" profile" ])
442+ { // set computed profile properties
443+ profile[" max_turn_weight" ] = context.properties .GetMaxTurnWeight ();
444+ }
445+
447446 sol::function turn_function = context.state [" turn_function" ];
448447 sol::function node_function = context.state [" node_function" ];
449448 sol::function way_function = context.state [" way_function" ];
You can’t perform that action at this time.
0 commit comments