wb: more robust side_actions_container::get_turn

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_
This commit is contained in:
gfgtdf 2018-04-30 18:24:43 +02:00 committed by Charles Dang
parent 9277a6cf53
commit ba6495c96a

View file

@ -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);
}
}