@@ -19,7 +19,8 @@ struct NodeID {
1919 // return os << ((p.idName != "") ? p.idName : std::to_string(p.idIndex));
2020 // }
2121 std::string to_string () {
22- return (idName != " " ) ? idName : std::format (" num{}" ,idIndex);
22+ // return (idName != "") ? idName : std::format("num{}",idIndex);
23+ return std::format (" {}[{}]" , idName, idIndex);
2324 }
2425
2526 bool operator < (const NodeID& other) const { // why tf is this here
@@ -50,11 +51,24 @@ struct NodePath {
5051 return result;
5152 }
5253
53-
54- static int getNumID (CCNode* node) {
54+ // Gets index of node among its siblings with same
55+ static int getNumID (CCNode* node) {
56+ std::string id = node->getID ();
5557 auto parent = node->getParent ();
56- auto siblings = parent->getChildren ();
57- return siblings->indexOfObject (node);
58+ auto siblings = parent->getChildrenExt (); // ?????
59+ // ext works with iterators
60+ // std::vector<CCNode*> filtered;
61+
62+ // for (auto sibling : siblings) {
63+ // if (sibling->getID() == id) {
64+ // filtered.push_back(sibling);
65+ // }
66+ // }
67+
68+ auto filtered = utils::ranges::filter (siblings, [id](CCNode* sibling){
69+ return sibling->getID () == id;
70+ });
71+ return std::distance (filtered.begin (), std::find (filtered.begin (), filtered.end (), node)); // why is this what c++ does for indexOf
5872 }
5973
6074 std::string to_string () {
0 commit comments