aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2010-07-29 09:08:20 +0000
committerFilippos Karapetis2010-07-29 09:08:20 +0000
commit82bf2437e34434a05392754b53853e21d27cfdd5 (patch)
tree42684a83435d924c3245ca3997c74d1041de5c3b
parent5d72193c512559394258051208b05f7089bb4c06 (diff)
downloadscummvm-rg350-82bf2437e34434a05392754b53853e21d27cfdd5.tar.gz
scummvm-rg350-82bf2437e34434a05392754b53853e21d27cfdd5.tar.bz2
scummvm-rg350-82bf2437e34434a05392754b53853e21d27cfdd5.zip
SCI: also break in AvoidPath instead of continuing, when the start point is contained in multiple polygons, otherwise we'll end up in an infinite loop
svn-id: r51458
-rw-r--r--engines/sci/engine/kpathing.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/engines/sci/engine/kpathing.cpp b/engines/sci/engine/kpathing.cpp
index 2f96fd9f60..fdebc0599c 100644
--- a/engines/sci/engine/kpathing.cpp
+++ b/engines/sci/engine/kpathing.cpp
@@ -933,9 +933,11 @@ static Common::Point *fixup_start_point(PathfindingState *s, const Common::Point
case POLY_NEAREST_ACCESS:
if (cont == CONT_INSIDE) {
if (s->_prependPoint != NULL) {
- // We shouldn't get here twice
+ // We shouldn't get here twice.
+ // We need to break in this case, otherwise we'll end in an infinite
+ // loop.
warning("AvoidPath: start point is contained in multiple polygons");
- continue;
+ break;
}
if (s->findNearPoint(start, (*it), new_start) != PF_OK) {
@@ -987,7 +989,7 @@ static Common::Point *fixup_end_point(PathfindingState *s, const Common::Point &
case POLY_NEAREST_ACCESS:
if (cont != CONT_OUTSIDE) {
if (s->_appendPoint != NULL) {
- // We shouldn't get here twice
+ // We shouldn't get here twice.
// Happens in LB2CD, inside the speakeasy when walking from the
// speakeasy (room 310) into the bathroom (room 320), after having
// consulted the notebook (bug #3036299).