aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2022-01-30 21:31:18 +0100
committerGitHub <noreply@github.com>2022-01-30 21:31:18 +0100
commitb66477c29f50c52c102be6412bb1754e0cfed143 (patch)
treeb52a7e9d629062aee9be42094d5a1c05ca403954 /src
parenta0e4b2bf54a1c21609a9683e15e01e016d52e75a (diff)
downloadminetest-b66477c29f50c52c102be6412bb1754e0cfed143.tar.gz
minetest-b66477c29f50c52c102be6412bb1754e0cfed143.tar.bz2
minetest-b66477c29f50c52c102be6412bb1754e0cfed143.zip
Abort raycasts that go out-of-bounds (#12006)
Diffstat (limited to 'src')
-rw-r--r--src/environment.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/environment.cpp b/src/environment.cpp
index 06f2b8bf9..b04f77557 100644
--- a/src/environment.cpp
+++ b/src/environment.cpp
@@ -169,6 +169,12 @@ void Environment::continueRaycast(RaycastState *state, PointedThing *result)
new_nodes.MaxEdge.Z = new_nodes.MinEdge.Z;
}
+ if (new_nodes.MaxEdge.X == S16_MAX ||
+ new_nodes.MaxEdge.Y == S16_MAX ||
+ new_nodes.MaxEdge.Z == S16_MAX) {
+ break; // About to go out of bounds
+ }
+
// For each untested node
for (s16 x = new_nodes.MinEdge.X; x <= new_nodes.MaxEdge.X; x++)
for (s16 y = new_nodes.MinEdge.Y; y <= new_nodes.MaxEdge.Y; y++)