diff options
author | Mitchell Stokes <mogurijin@gmail.com> | 2013-07-10 00:06:36 +0400 |
---|---|---|
committer | Mitchell Stokes <mogurijin@gmail.com> | 2013-07-10 00:06:36 +0400 |
commit | 83e9f32382810437bf113fee3b5c32881d7e67ec (patch) | |
tree | 60d1a6aef4accf267053a521a6d21ad117d64eee /source/gameengine/GameLogic/SCA_IScene.cpp | |
parent | f6502a67f203dbd57446f5b10cbdd82a4610e84c (diff) |
BGE: Committing patch #32422 "Debug properties for added objects" by HG1.
This patch allows debug properties from objects added to the scene at runtime to be displayed under the Debug Properties in the overhead display.
Diffstat (limited to 'source/gameengine/GameLogic/SCA_IScene.cpp')
-rw-r--r-- | source/gameengine/GameLogic/SCA_IScene.cpp | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/source/gameengine/GameLogic/SCA_IScene.cpp b/source/gameengine/GameLogic/SCA_IScene.cpp index c2ea8b4a8bc..60b4d19e155 100644 --- a/source/gameengine/GameLogic/SCA_IScene.cpp +++ b/source/gameengine/GameLogic/SCA_IScene.cpp @@ -74,9 +74,28 @@ std::vector<SCA_DebugProp*>& SCA_IScene::GetDebugProperties() void SCA_IScene::AddDebugProperty(class CValue* debugprop, const STR_String &name) { - SCA_DebugProp* dprop = new SCA_DebugProp(); - dprop->m_obj = debugprop; - debugprop->AddRef(); - dprop->m_name = name; - m_debugList.push_back(dprop); + if (m_debugList.size() < DEBUG_MAX_DISPLAY) { + SCA_DebugProp* dprop = new SCA_DebugProp(); + dprop->m_obj = debugprop; + debugprop->AddRef(); + dprop->m_name = name; + m_debugList.push_back(dprop); + } } + + +void SCA_IScene::RemoveObjectDebugProperties(class CValue* gameobj) +{ + vector<SCA_DebugProp*>::iterator it = m_debugList.begin(); + while(it != m_debugList.end()) { + CValue* debugobj = (*it)->m_obj; + + if (debugobj == gameobj) { + delete (*it); + m_debugList.erase(it); + continue; + } + ++it; + } +} + |