Skip to content

Commit fb766fe

Browse files
committed
replace uses of as cast
1 parent 9d28ab9 commit fb766fe

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

loader/src/ui/nodes/ListView.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ TableViewCell* ListView::getListCell(char const* key) {
7373
void ListView::loadCell(TableViewCell* cell, int index) {
7474
auto node = typeinfo_cast<CCNode*>(m_entries->objectAtIndex(index));
7575
if (node) {
76-
auto lcell = as<GenericListCell*>(cell);
76+
auto lcell = static_cast<GenericListCell*>(cell);
7777
node->setContentSize(lcell->getScaledContentSize());
7878
node->setPosition(0, 0);
7979
lcell->addChild(node);
@@ -123,7 +123,7 @@ void ListView::setCellBorderColor(cocos2d::ccColor4B color) {
123123

124124
void ListView::updateAllCells() {
125125
for (size_t i = 0; i < m_tableView->m_cellArray->count(); i++) {
126-
if (auto cell = as<GenericListCell*>(m_tableView->m_cellArray->objectAtIndex(i))) {
126+
if (auto cell = typeinfo_cast<GenericListCell*>(m_tableView->m_cellArray->objectAtIndex(i))) {
127127
cell->setPrimaryColor(m_primaryCellColor);
128128
cell->setSecondaryColor(m_secondaryCellColor);
129129
cell->setOpacity(m_cellOpacity);

loader/src/ui/nodes/MDTextArea.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ MDTextArea::~MDTextArea() {
158158
}
159159

160160
void MDTextArea::onLink(CCObject* pSender) {
161-
auto href = as<CCString*>(as<CCNode*>(pSender)->getUserObject());
161+
auto href = static_cast<CCString*>(static_cast<CCNode*>(pSender)->getUserObject());
162162
auto layer = FLAlertLayer::create(
163163
this, "Hold Up!",
164164
"Links are spooky! Are you sure you want to go to <cy>" + std::string(href->getCString()) +
@@ -170,7 +170,7 @@ void MDTextArea::onLink(CCObject* pSender) {
170170
}
171171

172172
void MDTextArea::onGDProfile(CCObject* pSender) {
173-
auto href = as<CCString*>(as<CCNode*>(pSender)->getUserObject());
173+
auto href = static_cast<CCString*>(static_cast<CCNode*>(pSender)->getUserObject());
174174
auto profile = std::string(href->getCString());
175175
profile = profile.substr(profile.find(":") + 1);
176176
auto res = numFromString<int>(profile);
@@ -188,7 +188,7 @@ void MDTextArea::onGDProfile(CCObject* pSender) {
188188
}
189189

190190
void MDTextArea::onGDLevel(CCObject* pSender) {
191-
auto href = as<CCString*>(as<CCNode*>(pSender)->getUserObject());
191+
auto href = static_cast<CCString*>(static_cast<CCNode*>(pSender)->getUserObject());
192192
auto level = std::string(href->getCString());
193193
level = level.substr(level.find(":") + 1);
194194
auto res = numFromString<int>(level);
@@ -208,14 +208,14 @@ void MDTextArea::onGDLevel(CCObject* pSender) {
208208
}
209209

210210
void MDTextArea::onGeodeMod(CCObject* sender) {
211-
auto href = as<CCString*>(as<CCNode*>(sender)->getUserObject());
211+
auto href = static_cast<CCString*>(static_cast<CCNode*>(sender)->getUserObject());
212212
auto modID = std::string(href->getCString());
213213
(void)openInfoPopup(modID.substr(modID.find(":") + 1));
214214
}
215215

216216
void MDTextArea::FLAlert_Clicked(FLAlertLayer* layer, bool btn) {
217217
if (btn) {
218-
web::openLinkInBrowser(as<CCString*>(layer->getUserObject())->getCString());
218+
web::openLinkInBrowser(static_cast<CCString*>(layer->getUserObject())->getCString());
219219
}
220220
}
221221

loader/src/ui/nodes/Notification.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ void Notification::showNextNotification() {
6363
// remove self from front of queue
6464
s_queue->removeFirstObject();
6565
if (auto obj = s_queue->firstObject()) {
66-
as<Notification*>(obj)->show();
66+
static_cast<Notification*>(obj)->show();
6767
}
6868
this->removeFromParent();
6969
}

loader/src/ui/nodes/TextRenderer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -429,8 +429,8 @@ std::vector<TextRenderer::Label> TextRenderer::renderStringEx(
429429
for (auto& btn : res)
430430
for (auto& b : res) {
431431
if (btn.m_node != b.m_node) {
432-
as<TextLinkedButtonWrapper*>(btn.m_node)
433-
->link(as<TextLinkedButtonWrapper*>(b.m_node));
432+
static_cast<TextLinkedButtonWrapper*>(btn.m_node)
433+
->link(static_cast<TextLinkedButtonWrapper*>(b.m_node));
434434
}
435435
}
436436
}
@@ -479,7 +479,7 @@ void TextRenderer::breakLine(float incY) {
479479
if (!y && m_fontStack.size()) {
480480
y = m_fontStack.back()(this->getCurrentStyle()).m_lineHeight * this->getCurrentScale();
481481
if (!y && m_lastRendered.size()) {
482-
y = as<CCNode*>(m_lastRendered.back().m_node)->getScaledContentSize().height;
482+
y = static_cast<CCNode*>(m_lastRendered.back().m_node)->getScaledContentSize().height;
483483
}
484484
if (!y && m_lastRenderedNode) {
485485
y = m_lastRenderedNode->getScaledContentSize().height;

0 commit comments

Comments
 (0)