Skip to content

Commit

Permalink
Fix a crash with FLAlertLayer
Browse files Browse the repository at this point in the history
  • Loading branch information
Alphalaneous committed Oct 30, 2024
1 parent 378de18 commit 71cf572
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 11 deletions.
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 1.6.2
- Fix a crash with cursed FLAlertLayers

## 1.6.1
- Bug fix for variables not working in popups created by HT Packs

Expand Down
2 changes: 1 addition & 1 deletion mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"android": "2.206",
"mac": "2.206"
},
"version": "v1.6.1",
"version": "v1.6.2",
"id": "alphalaneous.happy_textures",
"name": "Happy Textures :3",
"developer": "Alphalaneous",
Expand Down
2 changes: 1 addition & 1 deletion src/LabelValues.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ namespace LabelValues {
static std::pair<std::string, rift::Value> getLevelDescription() {
GJGameLevel* level = Utils::getLevel();
if (level) {
return LABEL("level_description", std::string(level->m_levelDesc));
return LABEL("level_description", std::string(level->getUnpackedLevelDescription()));
}
return LABEL("level_description", "null");
}
Expand Down
27 changes: 18 additions & 9 deletions src/nodes/FLAlertLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,34 @@
class $modify(MyFLAlertLayer, FLAlertLayer) {

struct Fields {
TextArea* m_contentTextArea;
CCLabelBMFont* m_title;
TextArea* m_contentTextArea = nullptr;
CCLabelBMFont* m_title = nullptr;
};

bool init(FLAlertLayerProtocol* p0, char const* p1, gd::string p2, char const* p3, char const* p4, float p5, bool p6, float p7, float p8) {
if (!FLAlertLayer::init(p0, p1, p2, p3, p4, p5, p6, p7, p8)) return false;

m_fields->m_contentTextArea = static_cast<TextArea*>(m_mainLayer->getChildByIDRecursive("content-text-area"));
m_fields->m_title = static_cast<CCLabelBMFont*>(m_mainLayer->getChildByID("title"));

if (m_mainLayer) {
if (CCNode* textArea = m_mainLayer->getChildByIDRecursive("content-text-area")) {
m_fields->m_contentTextArea = static_cast<TextArea*>(textArea);
}
if (CCNode* title = m_mainLayer->getChildByID("title")) {
m_fields->m_title = static_cast<CCLabelBMFont*>(title);
}
}
return true;
}

void setRift() {

MyTextArea* myTextArea = static_cast<MyTextArea*>(m_fields->m_contentTextArea);
myTextArea->setHappyTexturesModified(true);
if (m_fields->m_contentTextArea) {
MyTextArea* myTextArea = static_cast<MyTextArea*>(m_fields->m_contentTextArea);
myTextArea->setHappyTexturesModified(true);
}

MyCCLabelBMFont* myTitle = static_cast<MyCCLabelBMFont*>(m_fields->m_title);
myTitle->setHappyTexturesModified(true);
if (m_fields->m_title) {
MyCCLabelBMFont* myTitle = static_cast<MyCCLabelBMFont*>(m_fields->m_title);
myTitle->setHappyTexturesModified(true);
}
}
};

0 comments on commit 71cf572

Please sign in to comment.