fix geode uses of CCArrayExt

This commit is contained in:
matcool 2024-01-09 10:54:29 -03:00
parent 947dcf7f26
commit c3c055662f
8 changed files with 15 additions and 15 deletions

View file

@ -52,7 +52,7 @@ bool CCNode::hasAncestor(CCNode* ancestor) {
CCArray* Layout::getNodesToPosition(CCNode* on) const {
auto arr = CCArray::create();
for (auto child : CCArrayExt<CCNode>(on->getChildren())) {
for (auto child : CCArrayExt<CCNode*>(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<SpacerNode*> spacers;
for (auto& node : CCArrayExt<CCNode>(nodes)) {
for (auto& node : CCArrayExt<CCNode*>(nodes)) {
if (auto spacer = typeinfo_cast<SpacerNode*>(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<CCNode>(nodes)) {
for (auto node : CCArrayExt<CCNode*>(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<CCNode>(nodes)) {
for (auto node : CCArrayExt<CCNode*>(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<CCNode>(nodes)) {
for (auto& node : CCArrayExt<CCNode*>(nodes)) {
if (auto spacer = typeinfo_cast<SpacerNode*>(node)) {
spacer->setContentSize(CCSizeZero);
}
@ -751,7 +751,7 @@ void AxisLayout::apply(CCNode* on) {
bool doAutoScale = false;
bool first = true;
for (auto node : CCArrayExt<CCNode>(nodes)) {
for (auto node : CCArrayExt<CCNode*>(nodes)) {
int prio = 0;
if (auto opts = axisOpts(node)) {
prio = opts->getScalePriority();

View file

@ -103,7 +103,7 @@ void CCNode::setID(std::string const& id) {
}
CCNode* CCNode::getChildByID(std::string const& id) {
for (auto child : CCArrayExt<CCNode>(m_pChildren)) {
for (auto child : CCArrayExt<CCNode*>(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<CCNode>(m_pChildren)) {
for (auto child : CCArrayExt<CCNode*>(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<CCNode>(m_pChildren)) {
for (auto child : CCArrayExt<CCNode*>(m_pChildren)) {
child->setPosition(child->getPosition() + this->getScaledContentSize());
}
this->ignoreAnchorPointForPosition(false);

View file

@ -578,7 +578,7 @@ void ModListLayer::reloadList(bool keepScroll, std::optional<ModListQuery> const
}
void ModListLayer::updateAllStates() {
for (auto cell : CCArrayExt<GenericListCell>(
for (auto cell : CCArrayExt<GenericListCell*>(
m_list->m_listView->m_tableView->m_cellArray
)) {
static_cast<ModListCell*>(cell->getChildByID("mod-list-cell"))->updateState();

View file

@ -58,7 +58,7 @@ public:
// so that's why based MDContentLayer expects itself
// to have a CCMenu :-)
if (m_content) {
for (auto child : CCArrayExt<CCNode>(m_content->getChildren())) {
for (auto child : CCArrayExt<CCNode*>(m_content->getChildren())) {
auto y = this->getPositionY() + child->getPositionY();
child->setVisible(
!((m_content->getContentSize().height < y) ||

View file

@ -35,7 +35,7 @@ void SceneManager::forget(CCNode* node) {
}
void SceneManager::willSwitchToScene(CCScene* scene) {
for (auto node : CCArrayExt<CCNode>(m_persistedNodes)) {
for (auto node : CCArrayExt<CCNode*>(m_persistedNodes)) {
// no cleanup in order to keep actions running
node->removeFromParentAndCleanup(false);
scene->addChild(node);

View file

@ -18,7 +18,7 @@ void GenericContentLayer::setPosition(CCPoint const& pos) {
// all be TableViewCells
CCLayerColor::setPosition(pos);
for (auto child : CCArrayExt<CCNode>(m_pChildren)) {
for (auto child : CCArrayExt<CCNode*>(m_pChildren)) {
auto y = this->getPositionY() + child->getPositionY();
child->setVisible(!((m_obContentSize.height < y) || (y < -child->getContentSize().height)));
}

View file

@ -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<CCNode>(m_target->getChildren())) {
for (auto child : CCArrayExt<CCNode*>(m_target->getChildren())) {
child->setPosition(
child->getPositionX() + padX,
child->getPositionY() + m_target->getContentSize().height - coverage.size.height -

View file

@ -303,7 +303,7 @@ CCRect geode::cocos::calculateNodeCoverage(std::vector<CCNode*> const& nodes) {
CCRect geode::cocos::calculateNodeCoverage(CCArray* nodes) {
CCRect coverage;
for (auto child : CCArrayExt<CCNode>(nodes)) {
for (auto child : CCArrayExt<CCNode*>(nodes)) {
auto pos = child->getPosition() - child->getScaledContentSize() * child->getAnchorPoint();
auto csize = child->getPosition() +
child->getScaledContentSize() * (CCPoint{1.f, 1.f} - child->getAnchorPoint());