Skip to content

Commit

Permalink
Fixes instruction discarding in post-processing
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-j-h committed Mar 22, 2016
1 parent 4f15498 commit 057eb59
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/engine/guidance/post_processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include "engine/guidance/toolkit.hpp"

#include <boost/assert.hpp>
#include <boost/range/algorithm_ext/erase.hpp>

#include <iostream>
#include <vector>

Expand Down Expand Up @@ -237,18 +239,16 @@ std::vector<RouteStep> postProcess(std::vector<RouteStep> steps)

// finally clean up the post-processed instructions.
// Remove all, now NO_TURN instructions for the set of steps
auto pos = steps.begin();
for (auto check = steps.begin(); check != steps.end(); ++check)

// keep valid instructions
const auto not_is_valid = [](const RouteStep &step)
{
// keep valid instrucstions
if (check->maneuver.instruction != TurnInstruction::NO_TURN() ||
check->maneuver.waypoint_type != WaypointType::None)
{
*pos = *check;
++pos;
}
}
steps.erase(pos, steps.end());
return step.maneuver.instruction == TurnInstruction::NO_TURN() ||
step.maneuver.waypoint_type == WaypointType::None;
};

boost::remove_erase_if(steps, not_is_valid);

#if PRINT_DEBUG
std::cout << "Merged\n";
print(steps);
Expand Down

0 comments on commit 057eb59

Please sign in to comment.