Skip to content

Commit

Permalink
no dynamic_cast
Browse files Browse the repository at this point in the history
  • Loading branch information
user95401 committed Oct 19, 2024
1 parent c3f18a7 commit 7f6b696
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"id": "user95401.geode-mod-comments",
"name": "Mod Comments",
"version": "v1.1.1",
"version": "v1.1.2",
"developer": "user95401",
"description": "add comments in mod popups",
"tags": [ "online", "enhancement", "interface", "content", "developer" ],
Expand Down
4 changes: 2 additions & 2 deletions src/_main.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ namespace geode::cocos {
}
inline std::string frameName(CCNode* node) {
if (node == nullptr) return "NIL_NODE";
if (auto textureProtocol = dynamic_cast<CCTextureProtocol*>(node)) {
if (auto textureProtocol = typeinfo_cast<CCTextureProtocol*>(node)) {
if (auto texture = textureProtocol->getTexture()) {
if (auto spriteNode = dynamic_cast<CCSprite*>(node)) {
if (auto spriteNode = typeinfo_cast<CCSprite*>(node)) {
auto* cachedFrames = CCSpriteFrameCache::sharedSpriteFrameCache()->m_pSpriteFrames;
const auto rect = spriteNode->getTextureRect();
for (auto [key, frame] : CCDictionaryExt<std::string, CCSpriteFrame*>(cachedFrames)) {
Expand Down
6 changes: 3 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class GitHubAuthPopup : public FLAlertLayer, FLAlertLayerProtocol {
if (p0->getID() == "finish" and p1) {
//code
auto code = std::string("");
auto input = dynamic_cast<TextInput*>(p0->getChildByIDRecursive("input"));
auto input = typeinfo_cast<TextInput*>(p0->getChildByIDRecursive("input"));
if (input) code = input->getString();
//
auto a = [this, protocol](matjson::Value const& catgirl) {
Expand Down Expand Up @@ -234,9 +234,9 @@ class GitHubAuthPopup : public FLAlertLayer, FLAlertLayerProtocol {
pop->show();
}
void onPasteToInput(CCObject* btnObj) {
auto btn = dynamic_cast<CCNode*>(btnObj);
auto btn = typeinfo_cast<CCNode*>(btnObj);
auto menu = btn->getParent();
auto input = dynamic_cast<TextInput*>(menu->getChildByIDRecursive("input"));
auto input = typeinfo_cast<TextInput*>(menu->getChildByIDRecursive("input"));
input->setString(utils::clipboard::read());
};
void onOpenupBtn(CCObject*) {
Expand Down

0 comments on commit 7f6b696

Please sign in to comment.