Assert that tile calculation is correct.
This commit is contained in:
parent
6861329ab9
commit
9da16ca82d
1 changed files with 3 additions and 1 deletions
|
@ -135,9 +135,11 @@ namespace curry {
|
||||||
|
|
||||||
vec2us pixel_to_world_tile (const WorldGrid& parWorld, const vec2f& parPos) {
|
vec2us pixel_to_world_tile (const WorldGrid& parWorld, const vec2f& parPos) {
|
||||||
assert(position_is_on_map(parWorld, parPos));
|
assert(position_is_on_map(parWorld, parPos));
|
||||||
return vector_cast<vec2us>(
|
const auto retval = vector_cast<vec2us>(
|
||||||
parPos / vector_cast<vec2f>(parWorld.tile_size())
|
parPos / vector_cast<vec2f>(parWorld.tile_size())
|
||||||
);
|
);
|
||||||
|
assert(world_tile_to_pixel(parWorld, retval) <= parPos);
|
||||||
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
vec2f world_tile_to_pixel (const WorldGrid& parWorld, const vec2us& parTile) {
|
vec2f world_tile_to_pixel (const WorldGrid& parWorld, const vec2us& parTile) {
|
||||||
|
|
Loading…
Reference in a new issue