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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sat Mar 21 00:02:21 CET 2009


Revision: 39578
          http://scummvm.svn.sourceforge.net/scummvm/?rev=39578&view=rev
Author:   fingolfin
Date:     2009-03-20 23:02:20 +0000 (Fri, 20 Mar 2009)

Log Message:
-----------
SCI: cleanup

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

Modified: scummvm/trunk/engines/sci/engine/aatree.h
===================================================================
--- scummvm/trunk/engines/sci/engine/aatree.h	2009-03-20 22:55:42 UTC (rev 39577)
+++ scummvm/trunk/engines/sci/engine/aatree.h	2009-03-20 23:02:20 UTC (rev 39578)
@@ -78,7 +78,7 @@
 	}
 
 	// Returns a pointer to the smallest Key or NULL if the tree is empty.
-	const Key *findSmallest() {
+	const Key *findSmallest() const {
 		AATreeNode<Key> *node = _root;
 
 		if (node == _bottom)

Modified: scummvm/trunk/engines/sci/engine/kpathing.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kpathing.cpp	2009-03-20 22:55:42 UTC (rev 39577)
+++ scummvm/trunk/engines/sci/engine/kpathing.cpp	2009-03-20 23:02:20 UTC (rev 39578)
@@ -721,30 +721,29 @@
 
 typedef AATree<const Vertex *, EdgeIsCloser> EdgeAATree;
 
-static int visible(Vertex *vertex, Vertex *vertex_prev, int visible, EdgeAATree &tree) {
-	// Determines whether or not a vertex is visible from vertex_cur
-	// Parameters: (Vertex *) vertex: The vertex
-	//             (Vertex *) vertex_prev: The previous vertex in the sort
-	//                                       order, or NULL
-	//             (int) visible: 1 if vertex_prev is visible, 0 otherwise
-	//             (EdgeAATree &) tree: The tree of edges intersected by the
-	//                                  sweeping line
-	// Returns   : (int) 1 if vertex is visible from vertex_cur, 0 otherwise
-	const Vertex *const *edge;
+/**
+ * Determines whether or not a vertex is visible from vertex_cur.
+ * @param vertex		the vertex
+ * @param vertex_prev	the previous vertex in the sort order, or NULL
+ * @param visible		true if vertex_prev is visible, false otherwise
+ * @param tree			the tree of edges intersected by the sweeping line
+ * @return true if vertex is visible from vertex_cur, false otherwise
+ */
+static bool visible(Vertex *vertex, Vertex *vertex_prev, bool visible, const EdgeAATree &tree) {
 	Common::Point p = vertex_cur->v;
 	Common::Point w = vertex->v;
 
 	// Check if sweeping line intersects the interior of the polygon
 	// locally at vertex
 	if (inside(p, vertex))
-		return 0;
+		return false;
 
 	// If vertex_prev is on the sweeping line, then vertex is invisible
 	// if vertex_prev is invisible
 	if (vertex_prev && !visible && between(p, w, vertex_prev->v))
-		return 0;
+		return false;
 
-	edge = tree.findSmallest();
+	const Vertex *const *edge = tree.findSmallest();
 
 	if (edge) {
 		Common::Point p1, p2;
@@ -752,10 +751,10 @@
 		// Check for intersection with sweeping line before vertex
 		clockwise(*edge, &p1, &p2);
 		if (left(p2, p1, p) && left(p1, p2, w))
-			return 0;
+			return false;
 	}
 
-	return 1;
+	return true;
 }
 
 static void visible_vertices(PathfindingState *s, Vertex *vert) {
@@ -781,15 +780,16 @@
 		vertex = polygon->vertices.first();
 
 		// Check that there is more than one vertex.
-		if (VERTEX_HAS_EDGES(vertex))
+		if (VERTEX_HAS_EDGES(vertex)) {
 			CLIST_FOREACH(vertex, &polygon->vertices) {
-			Common::Point high, low;
-
-			// Add edges that intersect the initial position of the sweeping line
-			clockwise(vertex, &high, &low);
-
-			if ((high.y < p.y) && (low.y >= p.y) && (low != p))
-				tree.insert(vertex);
+				Common::Point high, low;
+	
+				// Add edges that intersect the initial position of the sweeping line
+				clockwise(vertex, &high, &low);
+	
+				if ((high.y < p.y) && (low.y >= p.y) && (low != p))
+					tree.insert(vertex);
+			}
 		}
 	}
 


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