Skip to content

Commit

Permalink
wb: more robust side_actions_container::get_turn
Browse files Browse the repository at this point in the history
the assumption

(turn_beginnings_[num] == it) => (get_turn(it) == num)

might be wrong in case that we have a turn with no actions, in which
case turn_beginnings_ contains duplicates and we actually want the upper
bound of (x <= it) in turn_beginnings_
  • Loading branch information
gfgtdf authored and Vultraz committed May 3, 2018
1 parent 9277a6c commit ba6495c
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/whiteboard/side_actions.cpp
Expand Up @@ -83,10 +83,8 @@ std::size_t side_actions_container::get_turn_impl(std::size_t begin, std::size_t
std::size_t mid = (begin+end) / 2;
if(it < turn_beginnings_[mid]) {
return get_turn_impl(begin, mid, it);
} else if(it > turn_beginnings_[mid]) {
return get_turn_impl(mid, end, it);
} else {
return mid;
return get_turn_impl(mid, end, it);
}
}

Expand Down

0 comments on commit ba6495c

Please sign in to comment.