@@ -311,9 +311,39 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
311311 " direction_reverse" ,
312312 Obstacle::Direction::Backward);
313313
314- context.state .new_enum <Obstacle::Type>(" obstacle_type" , Obstacle::SolTypeInitializerList);
315- context.state .new_enum <Obstacle::Direction>(" obstacle_direction" ,
316- Obstacle::SolDirectionInitializerList);
314+ context.state .new_enum (" obstacle_type" ,
315+ " none" ,
316+ Obstacle::Type::None,
317+ " barrier" ,
318+ Obstacle::Type::Barrier,
319+ " traffic_signals" ,
320+ Obstacle::Type::TrafficSignals,
321+ " stop" ,
322+ Obstacle::Type::Stop,
323+ " stop_minor" ,
324+ Obstacle::Type::StopMinor,
325+ " give_way" ,
326+ Obstacle::Type::GiveWay,
327+ " crossing" ,
328+ Obstacle::Type::Crossing,
329+ " traffic_calming" ,
330+ Obstacle::Type::TrafficCalming,
331+ " mini_roundabout" ,
332+ Obstacle::Type::MiniRoundabout,
333+ " turning_loop" ,
334+ Obstacle::Type::TurningLoop,
335+ " turning_circle" ,
336+ Obstacle::Type::TurningCircle);
337+
338+ context.state .new_enum (" obstacle_direction" ,
339+ " none" ,
340+ Obstacle::Direction::None,
341+ " forward" ,
342+ Obstacle::Direction::Forward,
343+ " backward" ,
344+ Obstacle::Direction::Backward,
345+ " both" ,
346+ Obstacle::Direction::Both);
317347
318348 context.state .new_usertype <Obstacle>(
319349 " Obstacle" ,
@@ -334,7 +364,7 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
334364 " add" ,
335365 [](ObstacleMap &obstacles, const osmium::Node &from, Obstacle obstacle)
336366 {
337- OSMNodeID id = static_cast <OSMNodeID>(from.id ());
367+ OSMNodeID id = to_alias <OSMNodeID>(from.id ());
338368 obstacles.emplace (id, obstacle);
339369 },
340370 " get" ,
@@ -362,7 +392,7 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
362392 if (obj.is <Obstacle::Direction>())
363393 {
364394 m_obstacle_map.emplace (
365- static_cast <OSMNodeID>(node.node ->id ()),
395+ to_alias <OSMNodeID>(node.node ->id ()),
366396 Obstacle{Obstacle::Type::TrafficSignals,
367397 obj.as <Obstacle::Direction>(),
368398 static_cast <float >(context.properties .GetTrafficSignalPenalty ()),
@@ -375,7 +405,7 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
375405 // state to the node
376406 // TODO: Make a breaking API change and remove this option.
377407 m_obstacle_map.emplace (
378- static_cast <OSMNodeID>(node.node ->id ()),
408+ to_alias <OSMNodeID>(node.node ->id ()),
379409 Obstacle{Obstacle::Type::TrafficSignals,
380410 Obstacle::Direction::Both,
381411 static_cast <float >(context.properties .GetTrafficSignalPenalty ()),
@@ -390,7 +420,7 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
390420 if (obj.is <bool >() && obj.as <bool >())
391421 {
392422 m_obstacle_map.emplace (
393- static_cast <OSMNodeID>(node.node ->id ()),
423+ to_alias <OSMNodeID>(node.node ->id ()),
394424 Obstacle{Obstacle::Type::Barrier, Obstacle::Direction::Both});
395425 }
396426 }));
0 commit comments