[Scummvm-cvs-logs] CVS: scummvm/sword2 mouse.cpp,1.48,1.49

Torbj?rn Andersson eriktorbjorn at users.sourceforge.net
Sun Jan 4 07:07:46 CET 2004


Update of /cvsroot/scummvm/scummvm/sword2
In directory sc8-pr-cvs1:/tmp/cvs-serv16332

Modified Files:
	mouse.cpp 
Log Message:
Some cleanup and Valgrind warning fixes.


Index: mouse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/mouse.cpp,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- mouse.cpp	28 Dec 2003 15:08:11 -0000	1.48
+++ mouse.cpp	4 Jan 2004 15:05:54 -0000	1.49
@@ -809,46 +809,36 @@
 }
 
 uint32 Sword2Engine::checkMouseList(void) {
-	int32 priority = 0;
-	uint32 j = 1;
-
-	if (_curMouse > 1) {
-		// Number of priorities subject to implementation needs
+	// Number of priorities subject to implementation needs
 
-		while (priority < 10) {
+	for (int priority = 0; priority < 10; priority++) {
+		for (uint i = 1; i < _curMouse; i++) {
 			// If the mouse pointer is over this
 			// mouse-detection-box
 
-			if (_mouseList[j].priority == priority &&
-			    _input->_mouseX + _thisScreen.scroll_offset_x >= _mouseList[j].x1 &&
-			    _input->_mouseX + _thisScreen.scroll_offset_x <= _mouseList[j].x2 &&
-			    _input->_mouseY + _thisScreen.scroll_offset_y >= _mouseList[j].y1 &&
-			    _input->_mouseY + _thisScreen.scroll_offset_y <= _mouseList[j].y2) {
+			if (_mouseList[i].priority == priority &&
+			    _input->_mouseX + _thisScreen.scroll_offset_x >= _mouseList[i].x1 &&
+			    _input->_mouseX + _thisScreen.scroll_offset_x <= _mouseList[i].x2 &&
+			    _input->_mouseY + _thisScreen.scroll_offset_y >= _mouseList[i].y1 &&
+			    _input->_mouseY + _thisScreen.scroll_offset_y <= _mouseList[i].y2) {
 				// Record id
-				_mouseTouching = _mouseList[j].id;
+				_mouseTouching = _mouseList[i].id;
 
 				// Change all COGS pointers to CROSHAIR
-				if (_mouseList[j].pointer == USE)
-					_mouseList[j].pointer = CROSHAIR;
+				if (_mouseList[i].pointer == USE)
+					_mouseList[i].pointer = CROSHAIR;
 
-				createPointerText(_mouseList[j].pointer_text, _mouseList[j].pointer);
+				createPointerText(_mouseList[i].pointer_text, _mouseList[i].pointer);
 
 				// Return pointer type
-				return _mouseList[j].pointer;
-			}
-
-			j++;
-			if (j == _curMouse) {
-				j = 0;
-				// Next priority - 0 being the highest, 9 the
-				// lowest
-				priority++;
+				return _mouseList[i].pointer;
 			}
 		}
 	}
 
-	_mouseTouching = 0;	// touching nothing
-	return 0;		// no pointer to return
+	// Touching nothing; no pointer to return
+	_mouseTouching = 0;
+	return 0;
 }
 
 #define POINTER_TEXT_WIDTH	640		// just in case!





More information about the Scummvm-git-logs mailing list