Fix fallback speed validity checks (#5300)

* fix fallback_speeds check to only accept values > 0

* add invalid_fallback_speed
This commit is contained in:
Kajari Ghosh
2018-12-10 14:53:30 -05:00
committed by GitHub
parent 2e17f3010a
commit 01ca32c81c
9 changed files with 157 additions and 75 deletions
+2 -2
View File
@@ -96,7 +96,7 @@ Status TablePlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms,
}
// Scan table for null results - if any exist, replace with distance estimates
if (params.fallback_speed > 0 || params.scale_factor > 0)
if (params.fallback_speed != INVALID_FALLBACK_SPEED || params.scale_factor > 0)
{
for (std::size_t row = 0; row < num_sources; row++)
{
@@ -104,7 +104,7 @@ Status TablePlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms,
{
const auto &table_index = row * num_destinations + column;
BOOST_ASSERT(table_index < result_tables_pair.first.size());
if (params.fallback_speed > 0 &&
if (params.fallback_speed != INVALID_FALLBACK_SPEED && params.fallback_speed > 0 &&
result_tables_pair.first[table_index] == MAXIMAL_EDGE_DURATION)
{
const auto &source =
+1 -1
View File
@@ -56,7 +56,7 @@ std::string getWrongOptionHelp(const engine::api::TableParameters &parameters)
help = "Number of coordinates needs to be at least two.";
}
if (parameters.fallback_speed < 0)
if (parameters.fallback_speed <= 0)
{
help = "fallback_speed must be > 0";
}