X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fcollision_grid_iterator.h;h=efed0b4ef19e9fcd8f95f9ff1d15f5a80a34a4f3;hb=04aa5516b5309ed9d7317fabb851642ce03a48f0;hp=9e22f629fe46590ce035810678e4a45e1ef49ce5;hpb=8e02ba38e2a98f9ea7f092e333f8085520e6c22a;p=supertux.git diff --git a/src/collision_grid_iterator.h b/src/collision_grid_iterator.h index 9e22f629f..efed0b4ef 100644 --- a/src/collision_grid_iterator.h +++ b/src/collision_grid_iterator.h @@ -13,20 +13,20 @@ public: CollisionGridIterator(CollisionGrid& newgrid, const Rectangle& bbox) : grid(newgrid) { - start_x = int(bbox.p1.x / grid.cell_width); + start_x = int(bbox.p1.x / grid.cell_width) - 2; if(start_x < 0) start_x = 0; x = start_x; - y = int(bbox.p1.y / grid.cell_height); + y = int(bbox.p1.y / grid.cell_height) - 2; if(y < 0) y = 0; - end_x = int(bbox.p2.x / grid.cell_width) + 1; + end_x = int(bbox.p2.x / grid.cell_width) + 2; if(end_x > (int) grid.cells_x) end_x = grid.cells_x; - end_y = int(bbox.p2.y / grid.cell_height) + 1; + end_y = int(bbox.p2.y / grid.cell_height) + 2; if(end_y > (int) grid.cells_y) end_y = grid.cells_y;