From f63c94df0295386470863b4f04421af8b3e0c5fc Mon Sep 17 00:00:00 2001 From: BlueBlock6 <66493630+blueblock6@users.noreply.github.com> Date: Tue, 12 Nov 2024 18:01:43 -0500 Subject: [PATCH] Update SecretRewardsLayer.cpp (#112) Fix crash and add ids for gold chest and key --- src/SecretRewardsLayer.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/SecretRewardsLayer.cpp b/src/SecretRewardsLayer.cpp index 41e0d0d..a951edc 100644 --- a/src/SecretRewardsLayer.cpp +++ b/src/SecretRewardsLayer.cpp @@ -1,4 +1,3 @@ -//TODO: fix for 2.207 crashes on line 17 #include #include #include @@ -40,7 +39,7 @@ void assignIDsToPage(CCLayer* page, int pageNum) { page->setID("page" + std::to_string(pageNum + 1)); - if (pageNum == 3) { // store page + if (pageNum == 4) { // store page if (auto menu = page->getChildByType(0)) { menu->setID("store-menu"); @@ -76,9 +75,9 @@ void assignIDsToPage(CCLayer* page, int pageNum) { // don't mind the first three indeces down there, for some reason the third page mixes them up idk // also these calls are pretty repetitive so they are all in 1 line bc wrapping them looks frankly disgusting lol - setIDSafe(page, pageNum == 2 ? 2 : 0, pageNum == 2 ? "chest-icon" : "tier-indicator"); - setIDSafe(page, pageNum == 2 ? 0 : 1, ((pageNum == 2 ? "milestone50" : "chest" + std::to_string(pageNum * 3 + 1)) + "-platform").c_str()); - setIDSafe(page, pageNum == 2 ? 1 : 2, ((pageNum == 2 ? "milestone50" : "chest" + std::to_string(pageNum * 3 + 1)) + "-cost" ).c_str()); + if(pageNum != 3) setIDSafe(page, pageNum == 2 ? 2 : 0, pageNum == 2 ? "chest-icon" : "tier-indicator"); + setIDSafe(page, pageNum >= 2 ? 0 : 1, ((pageNum == 2 ? "milestone50" : "chest" + std::to_string(pageNum * 3 + 1)) + "-platform").c_str()); + setIDSafe(page, pageNum >= 2 ? 1 : 2, ((pageNum == 2 ? "milestone50" : "chest" + std::to_string(pageNum * 3 + 1)) + "-cost" ).c_str()); setIDSafe(page, 3, ((pageNum == 2 ? "milestone100" : "chest" + std::to_string(pageNum * 3 + 2)) + "-platform").c_str()); setIDSafe(page, 4, ((pageNum == 2 ? "milestone100" : "chest" + std::to_string(pageNum * 3 + 2)) + "-cost" ).c_str()); setIDSafe(page, 5, ((pageNum == 2 ? "milestone200" : "chest" + std::to_string(pageNum * 3 + 3)) + "-platform").c_str()); @@ -100,6 +99,7 @@ void assignIDsToPage(CCLayer* page, int pageNum) { assignIDsToPage(pages->getChildByType(1), 1); assignIDsToPage(pages->getChildByType(2), 2); assignIDsToPage(pages->getChildByType(3), 3); + assignIDsToPage(pages->getChildByType(4), 4); } if (auto pageCircleWrapper = scrollLayer->getChildByType(0)) { @@ -109,6 +109,7 @@ void assignIDsToPage(CCLayer* page, int pageNum) { setIDSafe(pageCircleWrapper, 1, "page2"); setIDSafe(pageCircleWrapper, 2, "page3"); setIDSafe(pageCircleWrapper, 3, "page4"); + setIDSafe(pageCircleWrapper, 4, "page5"); } } } @@ -124,8 +125,10 @@ void assignIDsToPage(CCLayer* page, int pageNum) { setIDSafe(this, 1, "top-right-art"); setIDSafe(this, 2, "top-left-art"); setIDSafe(this, 3, "key-icon"); - setIDSafe(this, 4, "floor"); + setIDSafe(this, 4, "gold-key-icon"); + setIDSafe(this, 5, "floor"); setIDSafe(this, 0, "key-count"); + setIDSafe(this, 1, "gold-key-count"); setIDSafe(this, 0, "exit-menu"); };