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_

(cherry-picked from commit ba6495c96addbc8279d580e261acce6b589a6eeb)
This commit is contained in:
gfgtdf 2018-04-30 18:24:43 +02:00 committed by Charles Dang
parent 6e943d6cb4
commit 9b27585315

View File

@ -84,10 +84,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);
}
}