Skip to content

Commit

Permalink
explicitly implement check if is_only turn is restricted
Browse files Browse the repository at this point in the history
  • Loading branch information
DennisOSRM committed Jan 16, 2015
1 parent 7cf34a6 commit 959d9a3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
13 changes: 9 additions & 4 deletions data_structures/restriction_map.cpp
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions data_structures/restriction_map.hpp
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -28,14 +28,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef RESTRICTION_MAP_HPP
#define RESTRICTION_MAP_HPP

#include <memory>

#include "restriction.hpp"
#include "../Util/std_hash.hpp"
#include "../typedefs.h"

#include <boost/assert.hpp>

#include <memory>
#include <unordered_map>
#include <unordered_set>
#include <vector>
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 959d9a3

Please sign in to comment.