diff engine/core/model/structures/instance.cpp @ 587:2de93d36ca6d

Added getNextLocation() to the python interface file for the abstract pather. Fixed a problem when an instance changes rotation and does not notify the instance change listeners. Fixed a bug in SDLImage where m_isalphaoptimized was incorrectly set. Updated instance to no longer derive from ResourceClass. It now derives from FifeClass directly. fixes[t:475]
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Wed, 11 Aug 2010 16:52:57 +0000
parents 16c2b3ee59ce
children a46368b3d8a0
line wrap: on
line diff
--- a/engine/core/model/structures/instance.cpp	Sun Aug 08 22:54:11 2010 +0000
+++ b/engine/core/model/structures/instance.cpp	Wed Aug 11 16:52:57 2010 +0000
@@ -104,6 +104,7 @@
 
 	Instance::InstanceActivity::InstanceActivity(Instance& source):
 		m_location(source.m_location),
+		m_rotation(source.m_rotation),
 		m_facinglocation(),
 		m_action(),
 		m_speed(0),
@@ -131,6 +132,10 @@
 			source.m_changeinfo |= ICHANGE_LOC;
 			m_location = source.m_location;
 		}
+		if (m_rotation != source.m_rotation) {
+			source.m_changeinfo |= ICHANGE_ROTATION;
+			m_rotation = source.m_rotation;
+		}
 		if (source.m_facinglocation && (m_facinglocation != *source.m_facinglocation)) {
 			source.m_changeinfo |= ICHANGE_FACING_LOC;
 			m_facinglocation = *source.m_facinglocation;
@@ -208,7 +213,7 @@
 			}
 		}
 	}
-	
+
 	bool Instance::isActive() const {
 		return bool(m_activity);
 	}
@@ -224,7 +229,11 @@
 
 	void Instance::setRotation(int rotation) {
 		m_rotation = rotation;
-		m_changeinfo |= ICHANGE_ROTATION;
+		if(isActive()) {
+			refresh();
+		} else {
+			initializeChanges();
+		}
 	}
 
 	void Instance::setId(const std::string& identifier) {
@@ -577,8 +586,8 @@
                 }
         }
         void Instance::onInstanceDeleted(Instance* instance) {
-                if(m_activity && 
-                   m_activity->m_actioninfo && 
+                if(m_activity &&
+                   m_activity->m_actioninfo &&
                    m_activity->m_actioninfo->m_leader == instance) {
                         m_activity->m_actioninfo->m_leader = NULL;
                 }