Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPorteries Tristan <republicthunderbolt9@gmail.com>2015-05-15 17:17:18 +0300
committerPorteries Tristan <republicthunderbolt9@gmail.com>2015-05-15 17:20:06 +0300
commit371e5f25a054759014efa27c6fe4d497854ed64e (patch)
treeb89c85fab1e860fd322cf766139efb10674e79c3 /source/gameengine/Ketsji/KX_Scene.cpp
parentf4e8e70b5d77c9a6430f64bc223ab0a04b38f815 (diff)
BGE: Cleanup : merge 3 loop in 1 in function DupliGroupRecurse.
Diffstat (limited to 'source/gameengine/Ketsji/KX_Scene.cpp')
-rw-r--r--source/gameengine/Ketsji/KX_Scene.cpp39
1 files changed, 15 insertions, 24 deletions
diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp
index a460d9bd392..674f1e3c1b3 100644
--- a/source/gameengine/Ketsji/KX_Scene.cpp
+++ b/source/gameengine/Ketsji/KX_Scene.cpp
@@ -823,38 +823,29 @@ void KX_Scene::DupliGroupRecurse(CValue* obj, int level)
// the logic must be replicated first because we need
// the new logic bricks before relinking
vector<KX_GameObject*>::iterator git;
- for (git = m_logicHierarchicalGameObjects.begin();!(git==m_logicHierarchicalGameObjects.end());++git)
- {
- (*git)->ReParentLogic();
- }
-
- // relink any pointers as necessary, sort of a temporary solution
- for (git = m_logicHierarchicalGameObjects.begin();!(git==m_logicHierarchicalGameObjects.end());++git)
- {
+ for (git = m_logicHierarchicalGameObjects.begin(); git != m_logicHierarchicalGameObjects.end()); ++git) {
+ KX_GameObject *gameobj = *git;
+ gameobj->ReParentLogic();
+
+ // relink any pointers as necessary, sort of a temporary solution
// this will also relink the actuator to objects within the hierarchy
- (*git)->Relink(&m_map_gameobject_to_replica);
+ gameobj->Relink(&m_map_gameobject_to_replica);
// add the object in the layer of the parent
- (*git)->SetLayer(groupobj->GetLayer());
- }
+ gameobj->SetLayer(groupobj->GetLayer());
- // replicate crosslinks etc. between logic bricks
- for (git = m_logicHierarchicalGameObjects.begin();!(git==m_logicHierarchicalGameObjects.end());++git)
- {
- ReplicateLogic((*git));
- }
+ // replicate crosslinks etc. between logic bricks
+ ReplicateLogic(gameobj);
- // now look if object in the hierarchy have dupli group and recurse
- for (git = m_logicHierarchicalGameObjects.begin();!(git==m_logicHierarchicalGameObjects.end());++git)
- {
+ // now look if object in the hierarchy have dupli group and recurse
/* Replicate all constraints. */
- if ((*git)->GetPhysicsController()) {
- (*git)->GetPhysicsController()->ReplicateConstraints((*git), m_logicHierarchicalGameObjects);
- (*git)->ClearConstraints();
+ if (gameobj->GetPhysicsController()) {
+ gameobj->GetPhysicsController()->ReplicateConstraints(gameobj, m_logicHierarchicalGameObjects);
+ gameobj->ClearConstraints();
}
- if ((*git) != groupobj && (*git)->IsDupliGroup())
+ if (gameobj != groupobj && gameobj->IsDupliGroup())
// can't instantiate group immediately as it destroys m_logicHierarchicalGameObjects
- duplilist.push_back((*git));
+ duplilist.push_back(gameobj);
}
for (git = duplilist.begin(); !(git == duplilist.end()); ++git)