summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-02-04 07:56:20 +0100
committerStanislaw Halik <sthalik@misaki.pl>2024-02-04 07:56:20 +0100
commit1026f17a3e9c24bfcab0ddd0b63b9dd72ca3641d (patch)
tree0eec53f774ed76013b32c9d5ad0ac95362de5c9a
parent8b88f6023caee634bd2543c36fbdfbb7b8c2a23d (diff)
w
-rw-r--r--editor/tests/raycast-test.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/editor/tests/raycast-test.cpp b/editor/tests/raycast-test.cpp
index 199c70ba..1dcf1262 100644
--- a/editor/tests/raycast-test.cpp
+++ b/editor/tests/raycast-test.cpp
@@ -479,10 +479,16 @@ struct raycast_test : base_test
}
else if (k == nsteps)
{
- auto sign_long = sign_<int>(V[long_axis]);
- pos[long_axis] -= (int)(size[long_axis]/4) * sign_long;
- size[long_axis] -= size[long_axis]/2;
- size[long_axis] += tile_size<unsigned>.x() / 2;
+ constexpr auto add = (tile_size<unsigned>.x()+1)/2,
+ min_size = tile_size<unsigned>.x() + add;
+ if (size[long_axis] > min_size)
+ {
+ auto sign = sign_<int>(V[long_axis]);
+ auto off = (int)(size[long_axis]/2) - (int)add;
+ fm_debug_assert(off >= 0);
+ pos[long_axis] -= off/2 * sign;
+ size[long_axis] -= (unsigned)off;
+ }
}
pos -= Vector2i(fuzz);