diff --git a/include/extractor/compressed_edge_container.hpp b/include/extractor/compressed_edge_container.hpp index dc247066f..5b570e724 100644 --- a/include/extractor/compressed_edge_container.hpp +++ b/include/extractor/compressed_edge_container.hpp @@ -10,8 +10,6 @@ #include #include -#include - namespace osrm { namespace extractor @@ -41,8 +39,8 @@ class CompressedEdgeContainer const EdgeDuration duration2, // node-penalties can be added before/or after the traversal of an edge which // depends on whether we traverse the link forwards or backwards. - const boost::optional node_weight_penalty = boost::none, - const boost::optional node_duration_penalty = boost::none); + const EdgeWeight node_weight_penalty = INVALID_EDGE_WEIGHT, + const EdgeDuration node_duration_penalty = MAXIMAL_EDGE_DURATION); void AddUncompressedEdge(const EdgeID edge_id, const NodeID target_node, diff --git a/src/extractor/compressed_edge_container.cpp b/src/extractor/compressed_edge_container.cpp index c2ab11d66..9645e8f4a 100644 --- a/src/extractor/compressed_edge_container.cpp +++ b/src/extractor/compressed_edge_container.cpp @@ -112,8 +112,8 @@ void CompressedEdgeContainer::CompressEdge( const EdgeWeight weight2, const EdgeDuration duration1, const EdgeDuration duration2, - const boost::optional node_weight_penalty, - const boost::optional node_duration_penalty) + const EdgeWeight node_weight_penalty, + const EdgeDuration node_duration_penalty) { // remove super-trivial geometries BOOST_ASSERT(SPECIAL_EDGEID != edge_id_1); @@ -169,10 +169,10 @@ void CompressedEdgeContainer::CompressEdge( // if the via-node offers a penalty, we add the weight of the penalty as an artificial // segment that references SPECIAL_NODEID - if (node_weight_penalty && node_duration_penalty) + if (node_weight_penalty != INVALID_EDGE_WEIGHT && node_duration_penalty != MAXIMAL_EDGE_DURATION) { edge_bucket_list1.emplace_back(OnewayCompressedEdge{ - via_node_id, ClipWeight(*node_weight_penalty), ClipDuration(*node_duration_penalty)}); + via_node_id, ClipWeight(node_weight_penalty), ClipDuration(node_duration_penalty)}); } if (HasEntryForID(edge_id_2)) diff --git a/src/extractor/graph_compressor.cpp b/src/extractor/graph_compressor.cpp index 1af0617b5..4161466db 100644 --- a/src/extractor/graph_compressor.cpp +++ b/src/extractor/graph_compressor.cpp @@ -211,8 +211,8 @@ void GraphCompressor::Compress( // doesn't have access to. */ const bool has_node_penalty = traffic_signals.find(node_v) != traffic_signals.end(); - boost::optional node_duration_penalty = boost::none; - boost::optional node_weight_penalty = boost::none; + EdgeDuration node_duration_penalty = MAXIMAL_EDGE_DURATION; + EdgeWeight node_weight_penalty = INVALID_EDGE_WEIGHT; if (has_node_penalty) { // we cannot handle this as node penalty, if it depends on turn direction @@ -277,12 +277,12 @@ void GraphCompressor::Compress( graph.GetEdgeData(forward_e1).duration += forward_duration2; graph.GetEdgeData(reverse_e1).duration += reverse_duration2; - if (node_weight_penalty && node_duration_penalty) + if (node_weight_penalty != INVALID_EDGE_WEIGHT && node_duration_penalty != MAXIMAL_EDGE_DURATION) { - graph.GetEdgeData(forward_e1).weight += *node_weight_penalty; - graph.GetEdgeData(reverse_e1).weight += *node_weight_penalty; - graph.GetEdgeData(forward_e1).duration += *node_duration_penalty; - graph.GetEdgeData(reverse_e1).duration += *node_duration_penalty; + graph.GetEdgeData(forward_e1).weight += node_weight_penalty; + graph.GetEdgeData(reverse_e1).weight += node_weight_penalty; + graph.GetEdgeData(forward_e1).duration += node_duration_penalty; + graph.GetEdgeData(reverse_e1).duration += node_duration_penalty; } // extend e1's to targets of e2's