diff options
author | Mitchell Stokes <mogurijin@gmail.com> | 2011-09-17 00:08:05 +0400 |
---|---|---|
committer | Mitchell Stokes <mogurijin@gmail.com> | 2011-09-17 00:08:05 +0400 |
commit | 2636be0ac0d3139b2c9cf54f6380b2e9a3d3ed51 (patch) | |
tree | da77d619d929726d1db1916f9b3d3cd9ad3fb0d2 /source | |
parent | 0241e120891685b2ecb521e10f9e7a77d6910614 (diff) |
BGE Animations: Fixing some refcount issues with KX_Scene::m_animatedlist (fixes m_animatedlist crashes) and some whitespace issues with KX_GameObject::GetActionManager().
Diffstat (limited to 'source')
-rw-r--r-- | source/gameengine/Ketsji/KX_GameObject.cpp | 4 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_Scene.cpp | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index ae8d7094015..853b36b54f7 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -364,7 +364,9 @@ BL_ActionManager* KX_GameObject::GetActionManager() { // We only want to create an action manager if we need it if (!m_actionManager) - { KX_GetActiveScene()->AddAnimatedObject(this); m_actionManager = new BL_ActionManager(this); + { + KX_GetActiveScene()->AddAnimatedObject(this); + m_actionManager = new BL_ActionManager(this); } return m_actionManager; } diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index bdc30810b9e..7ff4a786387 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -1034,6 +1034,8 @@ int KX_Scene::NewRemoveObject(class CValue* gameobj) ret = newobj->Release(); if (m_euthanasyobjects->RemoveValue(newobj)) ret = newobj->Release(); + if (m_animatedlist->RemoveValue(newobj)) + ret = newobj->Release(); if (newobj == m_active_camera) { @@ -1525,6 +1527,7 @@ void KX_Scene::LogicBeginFrame(double curtime) void KX_Scene::AddAnimatedObject(CValue* gameobj) { + gameobj->AddRef(); m_animatedlist->Add(gameobj); } @@ -1537,7 +1540,7 @@ void KX_Scene::UpdateAnimations(double curtime) { // Update any animations for (int i=0; i<m_animatedlist->GetCount(); ++i) - ((KX_GameObject*)GetObjectList()->GetValue(i))->UpdateActionManager(curtime); + ((KX_GameObject*)m_animatedlist->GetValue(i))->UpdateActionManager(curtime); } void KX_Scene::LogicUpdateFrame(double curtime, bool frame) |