Assert that raytracing is going to finish at some point.

This commit is contained in:
King_DuckZ 2017-03-15 09:13:13 +00:00
parent d9a943ee4a
commit 2d05fd03db

View file

@ -138,10 +138,12 @@ namespace curry {
const vec2us last_tile = pixel_to_world_tile(parWorld, parTo); const vec2us last_tile = pixel_to_world_tile(parWorld, parTo);
while (parFunc(curr_tile) and last_tile != curr_tile) { while (parFunc(curr_tile) and last_tile != curr_tile) {
if (max.x() < max.y()) { if (max.x() < max.y()) {
assert(std::max(static_cast<uint16_t>(curr_tile.x() + step.x()), last_tile.x()) - std::min(static_cast<uint16_t>(curr_tile.x() + step.x()), last_tile.x()) < std::max(curr_tile.x(), last_tile.x()) - std::min(curr_tile.x(), last_tile.x()));
max.x() += delta.x(); max.x() += delta.x();
curr_tile.x() = static_cast<uint16_t>(curr_tile.x() + step.x()); curr_tile.x() = static_cast<uint16_t>(curr_tile.x() + step.x());
} }
else { else {
assert(std::max(static_cast<uint16_t>(curr_tile.y() + step.y()), last_tile.y()) - std::min(static_cast<uint16_t>(curr_tile.y() + step.y()), last_tile.y()) < std::max(curr_tile.y(), last_tile.y()) - std::min(curr_tile.y(), last_tile.y()));
max.y() += delta.y(); max.y() += delta.y();
curr_tile.y() = static_cast<uint16_t>(curr_tile.y() + step.y()); curr_tile.y() = static_cast<uint16_t>(curr_tile.y() + step.y());
} }