diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2009-09-25 01:22:24 +0400 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2009-09-25 01:22:24 +0400 |
commit | 1483fafd1372a3d3e025d08634e798adb7da512f (patch) | |
tree | 9191765749e29866339f4c31d892603f5f8b334d /source/gameengine/GameLogic/SCA_IObject.cpp | |
parent | c995c605f640d8d688e6e58e0fe247ca83f91696 (diff) | |
parent | 222fe6b1a5d49f67177cbb762f55a0e482145f5d (diff) |
Merge of itasc branch. Project files, scons and cmake should be working. Makefile updated but not tested. Comes with Eigen2 2.0.6 C++ matrix library.
Diffstat (limited to 'source/gameengine/GameLogic/SCA_IObject.cpp')
-rw-r--r-- | source/gameengine/GameLogic/SCA_IObject.cpp | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/source/gameengine/GameLogic/SCA_IObject.cpp b/source/gameengine/GameLogic/SCA_IObject.cpp index 2bffd029bd4..fbf66b64d08 100644 --- a/source/gameengine/GameLogic/SCA_IObject.cpp +++ b/source/gameengine/GameLogic/SCA_IObject.cpp @@ -26,6 +26,7 @@ * ***** END GPL LICENSE BLOCK ***** */ #include <iostream> +#include <algorithm> #include "SCA_IObject.h" #include "SCA_ISensor.h" @@ -76,6 +77,12 @@ SCA_IObject::~SCA_IObject() (*ita)->Delete(); } + SCA_ObjectList::iterator ito; + for (ito = m_registeredObjects.begin(); !(ito==m_registeredObjects.end()); ++ito) + { + (*ito)->UnlinkObject(this); + } + //T_InterpolatorList::iterator i; //for (i = m_interpolators.begin(); !(i == m_interpolators.end()); ++i) { // delete *i; @@ -123,6 +130,26 @@ void SCA_IObject::UnregisterActuator(SCA_IActuator* act) } } +void SCA_IObject::RegisterObject(SCA_IObject* obj) +{ + // one object may be registered multiple times via constraint target + // store multiple reference, this will serve as registration counter + m_registeredObjects.push_back(obj); +} + +void SCA_IObject::UnregisterObject(SCA_IObject* obj) +{ + SCA_ObjectList::iterator ito; + for (ito = m_registeredObjects.begin(); ito != m_registeredObjects.end(); ++ito) + { + if ((*ito) == obj) { + (*ito) = m_registeredObjects.back(); + m_registeredObjects.pop_back(); + break; + } + } +} + void SCA_IObject::ReParentLogic() { SCA_ActuatorList& oldactuators = GetActuators(); @@ -165,7 +192,7 @@ void SCA_IObject::ReParentLogic() // a new object cannot be client of any actuator m_registeredActuators.clear(); - + m_registeredObjects.clear(); } |