diff --git a/data_structures/restriction_map.cpp b/data_structures/restriction_map.cpp index 3c13d738a..b43be579c 100644 --- a/data_structures/restriction_map.cpp +++ b/data_structures/restriction_map.cpp @@ -1,6 +1,6 @@ /* -Copyright (c) 2014, Project OSRM, Dennis Luxen, others +Copyright (c) 2015, Project OSRM, Dennis Luxen, others All rights reserved. Redistribution and use in source and binary forms, with or without modification, @@ -149,11 +149,16 @@ bool RestrictionMap::CheckIfTurnIsRestricted(const NodeID node_u, { const unsigned index = restriction_iter->second; const auto &bucket = m_restriction_bucket_list.at(index); + for (const RestrictionTarget &restriction_target : bucket) { - if ((node_w == restriction_target.target_node) && // target found - (!restriction_target.is_only) // and not an only_-restr. - ) + if (node_w == restriction_target.target_node && // target found + !restriction_target.is_only) // and not an only_-restr. + { + return true; + } + if (node_w != restriction_target.target_node && // target not found + restriction_target.is_only) // and is an only restriction { return true; } diff --git a/data_structures/restriction_map.hpp b/data_structures/restriction_map.hpp index 7633faf4d..41eb17a8c 100644 --- a/data_structures/restriction_map.hpp +++ b/data_structures/restriction_map.hpp @@ -1,6 +1,6 @@ /* -Copyright (c) 2014, Project OSRM, Dennis Luxen, others +Copyright (c) 2015, Project OSRM, Dennis Luxen, others All rights reserved. Redistribution and use in source and binary forms, with or without modification, @@ -28,14 +28,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef RESTRICTION_MAP_HPP #define RESTRICTION_MAP_HPP -#include - #include "restriction.hpp" #include "../Util/std_hash.hpp" #include "../typedefs.h" #include +#include #include #include #include @@ -136,6 +135,7 @@ class RestrictionMap const unsigned index = restriction_iterator->second; auto &bucket = m_restriction_bucket_list.at(index); + for (RestrictionTarget &restriction_target : bucket) { if (node_v == restriction_target.target_node)