From: Anders R. <ma...@us...> - 2007-09-22 22:05:47
|
Update of /cvsroot/planeshift/planeshift/src/common/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24419/src/common/util Modified Files: pspath.cpp Log Message: -Fix for the reverse MovePath Index: pspath.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/common/util/pspath.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pspath.cpp 22 Sep 2007 17:37:45 -0000 1.1 --- pspath.cpp 22 Sep 2007 22:05:49 -0000 1.2 *************** *** 233,245 **** } ! // First find the current index. ! for (currentAtIndex = 0; currentAtIndex < (int)path->points.GetSize() -1 ; currentAtIndex++) { ! start = path->points[currentAtIndex]->startDistance[direction]; ! end = path->points[currentAtIndex+1]->startDistance[direction]; ! if (distance >= start && distance <= end) break; // Found segment } - currentAtFraction = (distance - start) / fabsf(end - start); currentAtDirection = direction; --- 233,258 ---- } ! if (direction == psPath::FORWARD) { ! // First find the current index. ! for (currentAtIndex = 0; currentAtIndex < (int)path->points.GetSize() -1 ; currentAtIndex++) ! { ! start = path->points[currentAtIndex]->startDistance[direction]; ! end = path->points[currentAtIndex+1]->startDistance[direction]; ! if (distance >= start && distance <= end) break; // Found segment ! } ! currentAtFraction = (distance - start) / (end - start); ! } else ! { ! // First find the current index. ! for (currentAtIndex = 0; currentAtIndex < (int)path->points.GetSize() -1 ; currentAtIndex++) ! { ! start = path->points[currentAtIndex+1]->startDistance[direction]; ! end = path->points[currentAtIndex]->startDistance[direction]; ! if (distance >= start && distance <= end) break; // Found segment ! } ! currentAtFraction = (end - distance) / (end - start); } currentAtDirection = direction; |