make sure result is always > 0, hits when origin and destination are on the same one-way segment in reversed order

This commit is contained in:
Dennis Luxen 2014-06-05 18:28:54 +02:00
parent 846505cbc8
commit bc063ded7a

View File

@ -154,7 +154,8 @@ template <class DataFacadeT> class ManyToManyRouting : public BasicRoutingInterf
const EdgeWeight current_distance = const EdgeWeight current_distance =
(*result_table)[source_id * number_of_locations + target_id]; (*result_table)[source_id * number_of_locations + target_id];
// check if new distance is better // check if new distance is better
if ((source_distance + target_distance) < current_distance) const EdgeWeight new_distance = source_distance + target_distance;
if (new_distance > 0 && new_distance < current_distance)
{ {
(*result_table)[source_id * number_of_locations + target_id] = (*result_table)[source_id * number_of_locations + target_id] =
(source_distance + target_distance); (source_distance + target_distance);