[Scummvm-cvs-logs] SF.net SVN: scummvm:[47698] scummvm/trunk/engines/sci/engine/kpathing.cpp

waltervn at users.sourceforge.net waltervn at users.sourceforge.net
Sat Jan 30 04:37:26 CET 2010


Revision: 47698
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47698&view=rev
Author:   waltervn
Date:     2010-01-30 03:37:26 +0000 (Sat, 30 Jan 2010)

Log Message:
-----------
SCI: AvoidPath: Allow solitary screen-edge vertices in path.

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kpathing.cpp

Modified: scummvm/trunk/engines/sci/engine/kpathing.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kpathing.cpp	2010-01-30 02:40:15 UTC (rev 47697)
+++ scummvm/trunk/engines/sci/engine/kpathing.cpp	2010-01-30 03:37:26 UTC (rev 47698)
@@ -1629,9 +1629,8 @@
  * 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 @@
 			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 @@
 			return output;
 		}
 
-		// Apply Dijkstra, avoiding screen edges
-		AStar(p, true);
+		// Apply Dijkstra
+		AStar(p);
 
 		output = output_path(p, s);
 		delete p;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list