void Chain::addAngle(int depth, float theta) { int i; Bone *target = this->root; for (i = 0; i < depth; i++) { /* avoid null pointer dereference */ if (target == NULL) return; /* move to next link in chain */ target = target->getChild(0); } /* do the rotation */ target->addAngle(theta); }