explicitly implement check if is_only turn is restricted

This commit is contained in:
Dennis Luxen 2015-01-16 15:49:29 +01:00
parent 7cf34a6d6f
commit 959d9a3ad9
2 changed files with 12 additions and 7 deletions

View File

@ -1,6 +1,6 @@
/* /*
Copyright (c) 2014, Project OSRM, Dennis Luxen, others Copyright (c) 2015, Project OSRM, Dennis Luxen, others
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, 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 unsigned index = restriction_iter->second;
const auto &bucket = m_restriction_bucket_list.at(index); const auto &bucket = m_restriction_bucket_list.at(index);
for (const RestrictionTarget &restriction_target : bucket) for (const RestrictionTarget &restriction_target : bucket)
{ {
if ((node_w == restriction_target.target_node) && // target found if (node_w == restriction_target.target_node && // target found
(!restriction_target.is_only) // and not an only_-restr. !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; return true;
} }

View File

@ -1,6 +1,6 @@
/* /*
Copyright (c) 2014, Project OSRM, Dennis Luxen, others Copyright (c) 2015, Project OSRM, Dennis Luxen, others
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, 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 #ifndef RESTRICTION_MAP_HPP
#define RESTRICTION_MAP_HPP #define RESTRICTION_MAP_HPP
#include <memory>
#include "restriction.hpp" #include "restriction.hpp"
#include "../Util/std_hash.hpp" #include "../Util/std_hash.hpp"
#include "../typedefs.h" #include "../typedefs.h"
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <memory>
#include <unordered_map> #include <unordered_map>
#include <unordered_set> #include <unordered_set>
#include <vector> #include <vector>
@ -136,6 +135,7 @@ class RestrictionMap
const unsigned index = restriction_iterator->second; const unsigned index = restriction_iterator->second;
auto &bucket = m_restriction_bucket_list.at(index); auto &bucket = m_restriction_bucket_list.at(index);
for (RestrictionTarget &restriction_target : bucket) for (RestrictionTarget &restriction_target : bucket)
{ {
if (node_v == restriction_target.target_node) if (node_v == restriction_target.target_node)