diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-12-02 16:36:11 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-12-02 16:37:41 +0000 |
commit | 826a380710261961eb339d12d44f1c45fc384131 (patch) | |
tree | 8864fc393373bb921ca46ed7bad9ae8405b9cb8e | |
parent | Extend ray for intersect walk to cover the extents of the map (diff) | |
download | ilt-826a380710261961eb339d12d44f1c45fc384131.tar.bz2 ilt-826a380710261961eb339d12d44f1c45fc384131.tar.xz ilt-826a380710261961eb339d12d44f1c45fc384131.zip |
Handle the case where the ray never enters the map
-rw-r--r-- | game/geoData.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/game/geoData.cpp b/game/geoData.cpp index 6c6f1df..e2b7f66 100644 --- a/game/geoData.cpp +++ b/game/geoData.cpp @@ -232,7 +232,11 @@ GeoData::walkUntil(const PointFace & from, const GlobalPosition2D to, const std: { auto f = from.face(this); if (!f.is_valid()) { - f = opposite_face_handle(findEntry(from.point, to)); + const auto entryEdge = findEntry(from.point, to); + if (!entryEdge.is_valid()) { + return; + } + f = opposite_face_handle(entryEdge); } FaceHandle previousFace; while (f.is_valid() && !op(f)) { |