File tree Expand file tree Collapse file tree 1 file changed +2
-7
lines changed
loader/include/Geode/utils Expand file tree Collapse file tree 1 file changed +2
-7
lines changed Original file line number Diff line number Diff line change @@ -642,18 +642,13 @@ namespace geode::cocos {
642642 /* *
643643 * Get child at index. Checks bounds. A negative
644644 * index will get the child starting from the end
645+ * @deprecated Use CCNode::getChildByIndex instead
645646 * @returns Child at index cast to the given type,
646647 * or nullptr if index exceeds bounds
647648 */
648649 template <class T = cocos2d::CCNode>
649650 static T* getChild (cocos2d::CCNode* x, int i) {
650- // start from end for negative index
651- if (i < 0 ) i = x->getChildrenCount () + i;
652- // check if backwards index is out of bounds
653- if (i < 0 ) return nullptr ;
654- // check if forwards index is out of bounds
655- if (static_cast <int >(x->getChildrenCount ()) <= i) return nullptr ;
656- return static_cast <T*>(x->getChildren ()->objectAtIndex (i));
651+ return x->getChildByIndex <T>(i);
657652 }
658653
659654 /* *
You can’t perform that action at this time.
0 commit comments