From d82b01cee99fbfd3b0177894b2479c11fde707ee Mon Sep 17 00:00:00 2001 From: Walter van Niftrik Date: Sat, 30 Jan 2010 03:37:26 +0000 Subject: SCI: AvoidPath: Allow solitary screen-edge vertices in path. svn-id: r47698 --- engines/sci/engine/kpathing.cpp | 14 ++++++-------- 1 file 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; -- cgit v1.2.3