[Scummvm-cvs-logs] SF.net SVN: scummvm:[39627] scummvm/trunk/engines/tinsel/polygons.cpp

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Mon Mar 23 09:49:05 CET 2009


Revision: 39627
          http://scummvm.svn.sourceforge.net/scummvm/?rev=39627&view=rev
Author:   dreammaster
Date:     2009-03-23 08:49:05 +0000 (Mon, 23 Mar 2009)

Log Message:
-----------
Bugfixes for incorrect Poly class usage in the CheckNPathIntegrity DEBUG method

Modified Paths:
--------------
    scummvm/trunk/engines/tinsel/polygons.cpp

Modified: scummvm/trunk/engines/tinsel/polygons.cpp
===================================================================
--- scummvm/trunk/engines/tinsel/polygons.cpp	2009-03-23 08:43:53 UTC (rev 39626)
+++ scummvm/trunk/engines/tinsel/polygons.cpp	2009-03-23 08:49:05 UTC (rev 39627)
@@ -1406,7 +1406,6 @@
 	uint8		*pps;	// Compiled polygon data
 	const POLYGON *rp;	// Run-time polygon structure
 	HPOLYGON	hp;
-	const Poly *cp;	// Compiled polygon structure
 	int		i, j;	// Loop counters
 	int		n;	// Last node in current path
 
@@ -1416,16 +1415,16 @@
 		rp = Polys[i];
 		if (rp && rp->polyType == PATH && rp->subtype == NODE) { //...if it's a node path
 			// Get compiled polygon structure
-			cp = (const Poly *)pps + rp->pIndex;	// This polygon
+			const Poly cp(pps, rp->pIndex);	// This polygon
 
-			n = cp->getNodecount() - 1;		// Last node
+			n = cp.getNodecount() - 1;		// Last node
 			assert(n >= 1); // Node paths must have at least 2 nodes
 
 			hp = PolygonIndex(rp);
 			for (j = 0; j <= n; j++) {
-				if (!IsInPolygon(cp->getNodeX(j), cp->getNodeY(j), hp)) {
+				if (!IsInPolygon(cp.getNodeX(j), cp.getNodeY(j), hp)) {
 					sprintf(TextBufferAddr(), "Node (%d, %d) is not in its own path (starting (%d, %d))",
-						 cp->getNodeX(j), cp->getNodeY(j), rp->cx[0], rp->cy[0]);
+						 cp.getNodeX(j), cp.getNodeY(j), rp->cx[0], rp->cy[0]);
 					error(TextBufferAddr());
 				}
 			}
@@ -1435,14 +1434,14 @@
 				if (rp->adjpaths[j] == NULL)
 					break;
 
-				if (IsInPolygon(cp->getNodeX(0), cp->getNodeY(0), PolygonIndex(rp->adjpaths[j]))) {
+				if (IsInPolygon(cp.getNodeX(0), cp.getNodeY(0), PolygonIndex(rp->adjpaths[j]))) {
 					sprintf(TextBufferAddr(), "Node (%d, %d) is in another path (starting (%d, %d))",
-						 cp->getNodeX(0), cp->getNodeY(0), rp->adjpaths[j]->cx[0], rp->adjpaths[j]->cy[0]);
+						 cp.getNodeX(0), cp.getNodeY(0), rp->adjpaths[j]->cx[0], rp->adjpaths[j]->cy[0]);
 					error(TextBufferAddr());
 				}
-				if (IsInPolygon(cp->getNodeX(n), cp->getNodeY(n), PolygonIndex(rp->adjpaths[j]))) {
+				if (IsInPolygon(cp.getNodeX(n), cp.getNodeY(n), PolygonIndex(rp->adjpaths[j]))) {
 					sprintf(TextBufferAddr(), "Node (%d, %d) is in another path (starting (%d, %d))",
-						 cp->getNodeX(n), cp->getNodeY(n), rp->adjpaths[j]->cx[0], rp->adjpaths[j]->cy[0]);
+						 cp.getNodeX(n), cp.getNodeY(n), rp->adjpaths[j]->cx[0], rp->adjpaths[j]->cy[0]);
 					error(TextBufferAddr());
 				}
 			}


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