HU-R2D2 / map

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

set_box_info works like a mask....

florenso opened this issue · comments

image

image

hier de code nog in text zodat je kan knippen en plakken:
std::cout << "is now " << map->get_box_info(tile).get_has_navigatable() <<
map->get_box_info(tile).get_has_obstacle() <<
map->get_box_info(tile).get_has_unknown() << std::endl;
std::cout << "needs to be " << info.get_has_navigatable() <<
info.get_has_obstacle() <<
info.get_has_unknown() << std::endl;
map->set_box_info(tile, info);
std::cout << "but is " << map->get_box_info(tile).get_has_navigatable() <<
map->get_box_info(tile).get_has_obstacle() <<
map->get_box_info(tile).get_has_unknown() << std::endl;

Confirmed unreproducible in latest commit (commit 127a9e4)

is now 001
needs to be 010
but is 010

complete reprod:

TEST(Testy, Test) {
    r2d2::ArrayBoxMap map{};
    r2d2::Box tile{r2d2::Coordinate{-1 * r2d2::Length::METER,
                                    -1 * r2d2::Length::METER,
                                    -1 * r2d2::Length::METER},
                   r2d2::Coordinate{1 * r2d2::Length::METER,
                                    1 * r2d2::Length::METER,
                                    1 * r2d2::Length::METER}};
    r2d2::BoxInfo info{true, false, false};
    std::cout << "is now " << map.get_box_info(tile).get_has_navigatable() <<
                                           map.get_box_info(tile).get_has_obstacle() <<
                                           map.get_box_info(tile).get_has_unknown() << std::endl;
    std::cout << "needs to be " << info.get_has_navigatable() <<
                                                    info.get_has_obstacle() <<
                                                    info.get_has_unknown() << std::endl;
    map.set_box_info(tile, info);
    std::cout << "but is " << map.get_box_info(tile).get_has_navigatable() <<
                                          map.get_box_info(tile).get_has_obstacle() <<
                                          map.get_box_info(tile).get_has_unknown() << std::endl;
}