[Scummvm-cvs-logs] CVS: scummvm/queen logic.h,1.57,1.58

David Eriksson twogood at users.sourceforge.net
Thu Nov 6 09:56:28 CET 2003


Update of /cvsroot/scummvm/scummvm/queen
In directory sc8-pr-cvs1:/tmp/cvs-serv1145/queen

Modified Files:
	logic.h 
Log Message:
Do not allow invalid room numbers.


Index: logic.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.h,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -d -r1.57 -r1.58
--- logic.h	6 Nov 2003 15:26:44 -0000	1.57
+++ logic.h	6 Nov 2003 17:54:59 -0000	1.58
@@ -122,13 +122,28 @@
 	~Logic();
 
 	uint16 currentRoom() const { return _currentRoom; }
-	void currentRoom(uint16 room) { _currentRoom = room; }
+	void currentRoom(uint16 room) { 
+		if (room >= 1 && room <= _numRooms)
+			_currentRoom = room; 
+		else
+			error("Invalid room number: %i", room);
+	}
 	
 	uint16 oldRoom() const { return _oldRoom; }
-	void oldRoom(uint16 room) { _oldRoom = room; }
+	void oldRoom(uint16 room) { 
+		if (room <= _numRooms)
+			_oldRoom = room; 
+		else
+			error("Invalid room number: %i", room);
+	}
 	
 	uint16 newRoom() const { return _newRoom; }
-	void newRoom(uint16 room) { _newRoom = room; }
+	void newRoom(uint16 room) { 
+		if (room <= _numRooms)
+			_newRoom = room; 
+		else
+			error("Invalid room number: %i", room);
+	}
 
 	ObjectData *objectData(int index);
 	uint16 roomData(int room);





More information about the Scummvm-git-logs mailing list