diff options
author | Walter van Niftrik | 2010-01-30 03:37:26 +0000 |
---|---|---|
committer | Walter van Niftrik | 2010-01-30 03:37:26 +0000 |
commit | d82b01cee99fbfd3b0177894b2479c11fde707ee (patch) | |
tree | f23195714d6496fd022fc695c5c3c3d08f1339c9 | |
parent | bc64dfb52e09345b149071674db480aebe456a76 (diff) | |
download | scummvm-rg350-d82b01cee99fbfd3b0177894b2479c11fde707ee.tar.gz scummvm-rg350-d82b01cee99fbfd3b0177894b2479c11fde707ee.tar.bz2 scummvm-rg350-d82b01cee99fbfd3b0177894b2479c11fde707ee.zip |
SCI: AvoidPath: Allow solitary screen-edge vertices in path.
svn-id: r47698
-rw-r--r-- | engines/sci/engine/kpathing.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/engines/sci/engine/kpathing.cpp b/engines/sci/engine/kpathing.cpp index 7766a98b36..f68b631e40 100644 --- a/engines/sci/engine/kpathing.cpp +++ b/engines/sci/engine/kpathing.cpp @@ -1629,9 +1629,8 @@ static int intersecting_polygons(PathfindingState *s) { * vertex_end back to vertex_start. If no path exists vertex_end->path_prev * will be NULL * Parameters: (PathfindingState *) s: The pathfinding state - * (bool) avoidScreenEdge: Avoid screen edges (default behavior) */ -static void AStar(PathfindingState *s, bool avoidScreenEdge) { +static void AStar(PathfindingState *s) { // Vertices of which the shortest path is known VertexList closedSet; @@ -1674,11 +1673,10 @@ static void AStar(PathfindingState *s, bool avoidScreenEdge) { if (closedSet.contains(vertex)) continue; - if (avoidScreenEdge) { - // Avoid plotting path along screen edge - if ((vertex != s->vertex_end) && s->pointOnScreenBorder(vertex->v)) + // Avoid plotting path along screen edge + if ((vertex_min != s->vertex_start) || (vertex != s->vertex_end)) + if (s->pointOnScreenBorder(vertex_min->v) && s->pointOnScreenBorder(vertex->v)) continue; - } if (!openSet.contains(vertex)) openSet.push_front(vertex); @@ -1867,8 +1865,8 @@ reg_t kAvoidPath(EngineState *s, int argc, reg_t *argv) { return output; } - // Apply Dijkstra, avoiding screen edges - AStar(p, true); + // Apply Dijkstra + AStar(p); output = output_path(p, s); delete p; |