[Scummvm-cvs-logs] SF.net SVN: scummvm:[45891] scummvm/trunk/engines/teenagent/objects.h

megath at users.sourceforge.net megath at users.sourceforge.net
Sat Nov 14 12:32:39 CET 2009


Revision: 45891
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45891&view=rev
Author:   megath
Date:     2009-11-14 11:32:39 +0000 (Sat, 14 Nov 2009)

Log Message:
-----------
made rects signed

Modified Paths:
--------------
    scummvm/trunk/engines/teenagent/objects.h

Modified: scummvm/trunk/engines/teenagent/objects.h
===================================================================
--- scummvm/trunk/engines/teenagent/objects.h	2009-11-14 11:29:37 UTC (rev 45890)
+++ scummvm/trunk/engines/teenagent/objects.h	2009-11-14 11:32:39 UTC (rev 45891)
@@ -32,7 +32,7 @@
 namespace TeenAgent {
 
 struct Rect {
-	uint16 left, top, right, bottom;
+	int16 left, top, right, bottom;
 
 	inline Rect() : left(0), top(0), right(0), bottom(0), _base(NULL) {}
 
@@ -47,7 +47,7 @@
 	}
 
 	inline bool valid() const {
-		return left < 320 && right < 320 && top < 200 && bottom < 200;
+		return left >= 0 && left < 320 && right >= 0 && right < 320 && top >= 0 && top < 200 && bottom >= 0 && bottom < 200;
 	}
 
 	void render(Graphics::Surface *surface, uint8 color) const;
@@ -74,6 +74,10 @@
 			SWAP(y1, y2);
 		return x >= left && x <= right && y1 <= bottom && y2 >= top;
 	}
+	
+	inline bool contains(const Rect & rect) const {
+		return rect.left >= left && rect.right <= right && rect.top >= top && rect.bottom <= bottom;
+	}
 
 protected:
 	byte * _base;


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