[Scummvm-cvs-logs] CVS: scummvm/saga actor.cpp,1.59,1.60 actor.h,1.29,1.30

Andrew Kurushin h00ligan at users.sourceforge.net
Wed Dec 29 06:34:10 CET 2004


Update of /cvsroot/scummvm/scummvm/saga
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19380

Modified Files:
	actor.cpp actor.h 
Log Message:
- fixed fingolfin notification

Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actor.cpp,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- actor.cpp	29 Dec 2004 12:59:17 -0000	1.59
+++ actor.cpp	29 Dec 2004 14:33:14 -0000	1.60
@@ -94,7 +94,7 @@
 	_xCellCount = _vm->getDisplayWidth() / 2;
 
 	_pathCellCount = _yCellCount * _xCellCount;
-	_pathCell = (byte*)malloc(_pathCellCount);
+	_pathCell = (int*)malloc(_pathCellCount * sizeof *_pathCell);
 	
 	_pathRect.left = 0;
 	_pathRect.right = _vm->getDisplayWidth();
@@ -1120,7 +1120,7 @@
 	Point bestPoint;
 	Point maskPoint;
 	int maskType1, maskType2;
-	byte cellValue;
+	int cellValue;
 	int i;
 	Rect intersect;
 	
@@ -1140,7 +1140,7 @@
 			maskType1 = _vm->_scene->getBGMaskType(maskPoint);
 			maskPoint.x += 1;
 			maskType2 = _vm->_scene->getBGMaskType(maskPoint);
-			cellValue = (maskType1 | maskType2) ? 'W' : -1;
+			cellValue = (maskType1 | maskType2) ? kPathCellBarrier : kPathCellEmpty;
 			setPathCell(iteratorPoint, cellValue);
 		}
 	}
@@ -1158,7 +1158,7 @@
 
 		for (iteratorPoint.y = intersect.top; iteratorPoint.y < intersect.bottom; iteratorPoint.y++) {
 			for (iteratorPoint.x = 0; iteratorPoint.x < _xCellCount; iteratorPoint.x++) {
-				setPathCell(iteratorPoint, 'W');
+				setPathCell(iteratorPoint, kPathCellBarrier);
 			}
 		}
 	}
@@ -1234,7 +1234,7 @@
 
 		iteratorPoint.x = point.x >> 1;
 		iteratorPoint.y = point.y - _vm->getPathYOffset();
-		if (getPathCell(iteratorPoint) == 'W')
+		if (getPathCell(iteratorPoint) == kPathCellBarrier)
 			return false;	
 	}
 	return true;
@@ -1284,14 +1284,7 @@
 			Point nextPoint;
 			nextPoint.x = samplePathDirection->x + pathDirection->x;
 			nextPoint.y = samplePathDirection->y + pathDirection->y;
-			// FIXME: The following two "if" statements are equivalent, but the first one at least
-			// generates no warning ;-)
-			// getPathCell returns a byte, which is unsigned, so "getPathCell(nextPoint)" < 0 is always false.
-			// I assume that the proper fix would be to change the return value of getPathCell to be signed
-			// or something like that, but I'll leave that to the authors...
-			// Alas, once more, compiling with all warnings and -Werror proves useful :-)
-			if (false) {
-			//if ((nextPoint.x >= 0) && (nextPoint.y >= 0) && (nextPoint.x < _xCellCount) && (nextPoint.y < _yCellCount) && (getPathCell(nextPoint) < 0)) {
+			if ((nextPoint.x >= 0) && (nextPoint.y >= 0) && (nextPoint.x < _xCellCount) && (nextPoint.y < _yCellCount) && (getPathCell(nextPoint) == kPathCellEmpty)) {
 				setPathCell(nextPoint, samplePathDirection->direction);
 
 				newPathDirectionIterator = pathDirectionList.pushBack();

Index: actor.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actor.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- actor.h	28 Dec 2004 21:27:17 -0000	1.29
+++ actor.h	29 Dec 2004 14:33:14 -0000	1.30
@@ -111,6 +111,10 @@
 	kActorRandom = (1 << 10)
 };
 
+enum PathCellType {
+	kPathCellEmpty = -1,
+	kPathCellBarrier = 0x57
+};
 
 struct PathDirectionData {
 	int direction;
@@ -279,10 +283,10 @@
 	void findActorPath(ActorData * actor, const Point &pointFrom, const Point &pointTo);
 	void handleSpeech(int msec);
 	void handleActions(int msec, bool setup);
-	void setPathCell(const Point &testPoint, byte value) {
+	void setPathCell(const Point &testPoint, int value) {
 		_pathCell[testPoint.x + testPoint.y * _xCellCount] = value;
 	}
-	byte getPathCell(const Point &testPoint) {
+	int getPathCell(const Point &testPoint) {
 		return _pathCell[testPoint.x + testPoint.y * _xCellCount];
 	}
 	bool scanPathLine(const Point &point1, const Point &point2);
@@ -296,7 +300,7 @@
 	SpeechData _activeSpeech;
 	Rect _barrierList[ACTOR_BARRIERS_MAX];
 	int _barrierCount;
-	byte *_pathCell;
+	int *_pathCell;
 	int _pathCellCount;
 	int _xCellCount;
 	int _yCellCount;





More information about the Scummvm-git-logs mailing list