From c3c055662fa10fad5ebc6d74f2efc673489f96e9 Mon Sep 17 00:00:00 2001 From: matcool <26722564+matcool@users.noreply.github.com> Date: Tue, 9 Jan 2024 10:54:29 -0300 Subject: [PATCH] fix geode uses of CCArrayExt --- loader/src/cocos2d-ext/Layout.cpp | 12 ++++++------ loader/src/hooks/GeodeNodeMetadata.cpp | 6 +++--- loader/src/ui/internal/list/ModListLayer.cpp | 2 +- loader/src/ui/nodes/MDTextArea.cpp | 2 +- loader/src/ui/nodes/SceneManager.cpp | 2 +- loader/src/ui/nodes/ScrollLayer.cpp | 2 +- loader/src/ui/nodes/TextRenderer.cpp | 2 +- loader/src/utils/cocos.cpp | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/loader/src/cocos2d-ext/Layout.cpp b/loader/src/cocos2d-ext/Layout.cpp index 06bdd3b9..d157c9ae 100644 --- a/loader/src/cocos2d-ext/Layout.cpp +++ b/loader/src/cocos2d-ext/Layout.cpp @@ -52,7 +52,7 @@ bool CCNode::hasAncestor(CCNode* ancestor) { CCArray* Layout::getNodesToPosition(CCNode* on) const { auto arr = CCArray::create(); - for (auto child : CCArrayExt(on->getChildren())) { + for (auto child : CCArrayExt(on->getChildren())) { if (!m_ignoreInvisibleChildren || child->isVisible()) { arr->addObject(child); } @@ -179,7 +179,7 @@ struct AxisLayout::Row : public CCObject { void accountSpacers(Axis axis, float availableLength, float crossLength) { std::vector spacers; - for (auto& node : CCArrayExt(nodes)) { + for (auto& node : CCArrayExt(nodes)) { if (auto spacer = typeinfo_cast(node)) { spacers.push_back(spacer); } @@ -259,7 +259,7 @@ bool AxisLayout::shouldAutoScale(AxisLayoutOptions const* opts) const { float AxisLayout::minScaleForPrio(CCArray* nodes, int prio) const { float min = AXISLAYOUT_DEFAULT_MIN_SCALE; bool first = true; - for (auto node : CCArrayExt(nodes)) { + for (auto node : CCArrayExt(nodes)) { auto scale = optsMinScale(axisOpts(node)); if (first) { min = scale; @@ -275,7 +275,7 @@ float AxisLayout::minScaleForPrio(CCArray* nodes, int prio) const { float AxisLayout::maxScaleForPrio(CCArray* nodes, int prio) const { float max = 1.f; bool first = true; - for (auto node : CCArrayExt(nodes)) { + for (auto node : CCArrayExt(nodes)) { auto scale = optsMaxScale(axisOpts(node)); if (first) { max = scale; @@ -490,7 +490,7 @@ void AxisLayout::tryFitLayout( float crossSquishFactor = 0.f; // make spacers have zero size so they don't affect spacing calculations - for (auto& node : CCArrayExt(nodes)) { + for (auto& node : CCArrayExt(nodes)) { if (auto spacer = typeinfo_cast(node)) { spacer->setContentSize(CCSizeZero); } @@ -751,7 +751,7 @@ void AxisLayout::apply(CCNode* on) { bool doAutoScale = false; bool first = true; - for (auto node : CCArrayExt(nodes)) { + for (auto node : CCArrayExt(nodes)) { int prio = 0; if (auto opts = axisOpts(node)) { prio = opts->getScalePriority(); diff --git a/loader/src/hooks/GeodeNodeMetadata.cpp b/loader/src/hooks/GeodeNodeMetadata.cpp index 5aa45d1a..5b27626a 100644 --- a/loader/src/hooks/GeodeNodeMetadata.cpp +++ b/loader/src/hooks/GeodeNodeMetadata.cpp @@ -103,7 +103,7 @@ void CCNode::setID(std::string const& id) { } CCNode* CCNode::getChildByID(std::string const& id) { - for (auto child : CCArrayExt(m_pChildren)) { + for (auto child : CCArrayExt(m_pChildren)) { if (child->getID() == id) { return child; } @@ -115,7 +115,7 @@ CCNode* CCNode::getChildByIDRecursive(std::string const& id) { if (auto child = this->getChildByID(id)) { return child; } - for (auto child : CCArrayExt(m_pChildren)) { + for (auto child : CCArrayExt(m_pChildren)) { if ((child = child->getChildByIDRecursive(id))) { return child; } @@ -131,7 +131,7 @@ void CCNode::removeChildByID(std::string const& id) { void CCNode::setLayout(Layout* layout, bool apply, bool respectAnchor) { if (respectAnchor && this->isIgnoreAnchorPointForPosition()) { - for (auto child : CCArrayExt(m_pChildren)) { + for (auto child : CCArrayExt(m_pChildren)) { child->setPosition(child->getPosition() + this->getScaledContentSize()); } this->ignoreAnchorPointForPosition(false); diff --git a/loader/src/ui/internal/list/ModListLayer.cpp b/loader/src/ui/internal/list/ModListLayer.cpp index e027ff07..601481a1 100644 --- a/loader/src/ui/internal/list/ModListLayer.cpp +++ b/loader/src/ui/internal/list/ModListLayer.cpp @@ -578,7 +578,7 @@ void ModListLayer::reloadList(bool keepScroll, std::optional const } void ModListLayer::updateAllStates() { - for (auto cell : CCArrayExt( + for (auto cell : CCArrayExt( m_list->m_listView->m_tableView->m_cellArray )) { static_cast(cell->getChildByID("mod-list-cell"))->updateState(); diff --git a/loader/src/ui/nodes/MDTextArea.cpp b/loader/src/ui/nodes/MDTextArea.cpp index 0ec4e143..f19a98a6 100644 --- a/loader/src/ui/nodes/MDTextArea.cpp +++ b/loader/src/ui/nodes/MDTextArea.cpp @@ -58,7 +58,7 @@ public: // so that's why based MDContentLayer expects itself // to have a CCMenu :-) if (m_content) { - for (auto child : CCArrayExt(m_content->getChildren())) { + for (auto child : CCArrayExt(m_content->getChildren())) { auto y = this->getPositionY() + child->getPositionY(); child->setVisible( !((m_content->getContentSize().height < y) || diff --git a/loader/src/ui/nodes/SceneManager.cpp b/loader/src/ui/nodes/SceneManager.cpp index ee7a4247..88c74a9b 100644 --- a/loader/src/ui/nodes/SceneManager.cpp +++ b/loader/src/ui/nodes/SceneManager.cpp @@ -35,7 +35,7 @@ void SceneManager::forget(CCNode* node) { } void SceneManager::willSwitchToScene(CCScene* scene) { - for (auto node : CCArrayExt(m_persistedNodes)) { + for (auto node : CCArrayExt(m_persistedNodes)) { // no cleanup in order to keep actions running node->removeFromParentAndCleanup(false); scene->addChild(node); diff --git a/loader/src/ui/nodes/ScrollLayer.cpp b/loader/src/ui/nodes/ScrollLayer.cpp index 6ab57e38..dc82ba08 100644 --- a/loader/src/ui/nodes/ScrollLayer.cpp +++ b/loader/src/ui/nodes/ScrollLayer.cpp @@ -18,7 +18,7 @@ void GenericContentLayer::setPosition(CCPoint const& pos) { // all be TableViewCells CCLayerColor::setPosition(pos); - for (auto child : CCArrayExt(m_pChildren)) { + for (auto child : CCArrayExt(m_pChildren)) { auto y = this->getPositionY() + child->getPositionY(); child->setVisible(!((m_obContentSize.height < y) || (y < -child->getContentSize().height))); } diff --git a/loader/src/ui/nodes/TextRenderer.cpp b/loader/src/ui/nodes/TextRenderer.cpp index ca7396b3..10f2e30b 100644 --- a/loader/src/ui/nodes/TextRenderer.cpp +++ b/loader/src/ui/nodes/TextRenderer.cpp @@ -246,7 +246,7 @@ CCNode* TextRenderer::end( case TextAlignment::End: padY = std::max(m_size.height - renderedHeight, 0.f); break; } // adjust child positions - for (auto child : CCArrayExt(m_target->getChildren())) { + for (auto child : CCArrayExt(m_target->getChildren())) { child->setPosition( child->getPositionX() + padX, child->getPositionY() + m_target->getContentSize().height - coverage.size.height - diff --git a/loader/src/utils/cocos.cpp b/loader/src/utils/cocos.cpp index 03abacf3..e5a4b1a0 100644 --- a/loader/src/utils/cocos.cpp +++ b/loader/src/utils/cocos.cpp @@ -303,7 +303,7 @@ CCRect geode::cocos::calculateNodeCoverage(std::vector const& nodes) { CCRect geode::cocos::calculateNodeCoverage(CCArray* nodes) { CCRect coverage; - for (auto child : CCArrayExt(nodes)) { + for (auto child : CCArrayExt(nodes)) { auto pos = child->getPosition() - child->getScaledContentSize() * child->getAnchorPoint(); auto csize = child->getPosition() + child->getScaledContentSize() * (CCPoint{1.f, 1.f} - child->getAnchorPoint());