Changeset View
Changeset View
Standalone View
Standalone View
source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
| Context not available. | |||||
| return true; | return true; | ||||
| } | } | ||||
| void CcdPhysicsController::ReplicateConstraints(KX_GameObject *replica, std::vector<KX_GameObject*> constobj) | |||||
| { | |||||
| if (replica->GetConstraints().size() > 0 && replica->GetPhysicsController()) { | |||||
sybren: Invert the condition to `(replica->GetConstraints().size() == 0 || !replica… | |||||
| vector<bRigidBodyJointConstraint*> constraints = replica->GetConstraints(); | |||||
| vector<bRigidBodyJointConstraint*>::iterator consit; | |||||
| // object could have some constraints, iterate over all of theme to ensure | |||||
| // that every constraint is recreated | |||||
| for (consit = constraints.begin(); consit != constraints.end(); ++consit) { | |||||
| // try to find the constraint targets in the list of group objects | |||||
| bRigidBodyJointConstraint* dat = (*consit); | |||||
| vector<KX_GameObject*>::iterator memit; | |||||
| for (memit = constobj.begin(); | |||||
| memit != constobj.end(); ++memit) | |||||
| { | |||||
| KX_GameObject *member = (*memit); | |||||
| // if the group member is the actual target for the constraint | |||||
| if (dat->tar->id.name+2 == member->GetName() && member->GetPhysicsController()) { | |||||
| GetPhysicsEnvironment()->SetupObjectConstraints(replica, member, dat); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| /////////////////////////////////////////////////////////// | /////////////////////////////////////////////////////////// | ||||
| ///A small utility class, DefaultMotionState | ///A small utility class, DefaultMotionState | ||||
| /// | /// | ||||
| Context not available. | |||||
Not Done Inline ActionsStyle: bRigidBodyJointConstraint *dat sybren: Style: `bRigidBodyJointConstraint *dat` | |||||
Not Done Inline ActionsStyle: opening bracket on same line as for sybren: Style: opening bracket on same line as `for` | |||||
Not Done Inline ActionsGetPhysicsEnvironment() can be moved outside the loop. sybren: `GetPhysicsEnvironment()` can be moved outside the loop. | |||||
Invert the condition to (replica->GetConstraints().size() == 0 || !replica->GetPhysicsController()), and you can immediately return, unindenting the entire method a level.