[Scummvm-cvs-logs] SF.net SVN: scummvm:[45272] scummvm/trunk/engines/sci/engine/kpathing.cpp
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Tue Oct 20 16:43:44 CEST 2009
Revision: 45272
http://scummvm.svn.sourceforge.net/scummvm/?rev=45272&view=rev
Author: thebluegr
Date: 2009-10-20 14:43:44 +0000 (Tue, 20 Oct 2009)
Log Message:
-----------
Changed kAvoidPath() to always avoid screen edges, after talking with waltervn. Also, formatted the comments of the dijkstra() function
Modified Paths:
--------------
scummvm/trunk/engines/sci/engine/kpathing.cpp
Modified: scummvm/trunk/engines/sci/engine/kpathing.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kpathing.cpp 2009-10-20 14:07:27 UTC (rev 45271)
+++ scummvm/trunk/engines/sci/engine/kpathing.cpp 2009-10-20 14:43:44 UTC (rev 45272)
@@ -1496,12 +1496,15 @@
return 0;
}
+/**
+ * Computes a shortest path from vertex_start to vertex_end. The caller can
+ * construct the resulting path by following the path_prev links from
+ * 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 dijkstra(PathfindingState *s, bool avoidScreenEdge) {
- // Computes a shortest path from vertex_start to vertex_end. The caller can
- // construct the resulting path by following the path_prev links from
- // vertex_end back to vertex_start. If no path exists vertex_end->path_prev
- // will be NULL
- // Parameters: (PathfindingState *) s: The pathfinding state
Polygon *polygon;
// Vertices of which the shortest path is known
@@ -1712,17 +1715,9 @@
return output;
}
- // Early pathfinding-enabled games exclude edges on screen borders.
- // FIXME: Enable this selectively for those games that need it.
- bool avoidScreenEdge = false;
+ // Apply Dijkstra, avoiding screen edges
+ dijkstra(p, true);
- // This is certainly needed for LSL5 room 640, otherwise Patti walks off-screen
- // and reenters through the wall
- if (s->_gameName == "lsl5" && s->currentRoomNumber() == 640)
- avoidScreenEdge = true;
-
- dijkstra(p, avoidScreenEdge);
-
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