Skip to content

Commit

Permalink
int i = getChildrenCount() - 1; i >= 0; i--
Browse files Browse the repository at this point in the history
  • Loading branch information
RayDeeUx committed Jul 29, 2024
1 parent 414ca0c commit a108138
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ class $modify(MyPlayLayer, PlayLayer) {
if (!Mod::get()->getSettingValue<bool>("enabled")) { return; }
if (m_level->isPlatformer()) { return; }
if (!m_player1->m_isDead) { return; }
for (int i = this->getChildrenCount(); i-- > 0; ) {
for (int i = getChildrenCount() - 1; i >= 0; i--) {
// NEW [good]: int i = getChildrenCount() - 1; i >= 0; i--
// ORIG [bad]: int i = getChildrenCount(); i-- > 0;
auto theLastCCNode = typeinfo_cast<CCNode*>(this->getChildren()->objectAtIndex(i));
if (typeinfo_cast<CurrencyRewardLayer*>(theLastCCNode) != nullptr) {
theLastCCNode->setVisible(!Mod::get()->getSettingValue<bool>("currencyLayer"));
Expand Down

0 comments on commit a108138

Please sign in to comment.