diff engine/core/view/camera.cpp @ 10:ab09325f901e

Camera was attached to instance on a different layer, resulting in strange scrolling. Fixed it, and added a check to prevent this happening again (attach-to-other-layer fails and logs a warning).
author jwt@33b003aa-7bff-0310-803a-e67f0ece8222
date Sun, 06 Jul 2008 17:13:06 +0000
parents 4a0efb7baf70
children 40a7c9618ade
line wrap: on
line diff
--- a/engine/core/view/camera.cpp	Sun Jul 06 10:12:17 2008 +0000
+++ b/engine/core/view/camera.cpp	Sun Jul 06 17:13:06 2008 +0000
@@ -343,6 +343,11 @@
 	}
 
 	void Camera::attach(Instance *instance) {
+		// fail if the layers aren't the same
+		if (m_location.getLayer()->getId() != instance->getLocation().getLayer()->getId()) {
+			FL_WARN(_log, "Tried to attach camera to instance on different layer.");
+			return ;
+		}
 		m_attachedto = instance;
 	}