diff options
-rw-r--r-- | src/gui/fonts/font.cpp | 12 | ||||
-rw-r--r-- | src/gui/popups/popupmenu.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/tabbedarea.cpp | 2 | ||||
-rw-r--r-- | src/gui/windowmenu.cpp | 12 | ||||
-rw-r--r-- | src/gui/windows/botcheckerwindow.cpp | 9 | ||||
-rw-r--r-- | src/gui/windows/chatwindow.cpp | 3 | ||||
-rw-r--r-- | src/net/eathena/gamehandler.cpp | 2 | ||||
-rw-r--r-- | src/net/tmwa/gamehandler.cpp | 2 |
8 files changed, 18 insertions, 26 deletions
diff --git a/src/gui/fonts/font.cpp b/src/gui/fonts/font.cpp index cac29d758..469d4e81c 100644 --- a/src/gui/fonts/font.cpp +++ b/src/gui/fonts/font.cpp @@ -213,12 +213,8 @@ void Font::drawString(Graphics *const graphics, return; } - Graphics *const g = dynamic_cast<Graphics *const>(graphics); - if (!g) - return; - - Color col = g->getColor(); - const Color &col2 = g->getColor2(); + Color col = graphics->getColor(); + const Color &col2 = graphics->getColor2(); const float alpha = static_cast<float>(col.a) / 255.0F; /* The alpha value is ignored at string generation so avoid caching the @@ -240,7 +236,7 @@ void Font::drawString(Graphics *const graphics, if (image) { image->setAlpha(alpha); - g->drawImage(image, x, y); + graphics->drawImage(image, x, y); } } else @@ -262,7 +258,7 @@ void Font::drawString(Graphics *const graphics, const Image *const image = chunk2->img; if (image) - g->drawImage(image, x, y); + graphics->drawImage(image, x, y); } BLOCK_END("Font::drawString") } diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index f01a57a4e..591ccf540 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -1884,7 +1884,7 @@ void PopupMenu::showPopup(const int x, const int y, Button *const button) for (std::vector<Button *>::const_iterator it = names.begin(), it_end = names.end(); it != it_end; ++ it) { - const Button *const btn = dynamic_cast<const Button*>(*it); + const Button *const btn = *it; if (!btn || btn->getActionEventId() == "SET") continue; diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index 818dd85df..dbfc068e6 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -396,7 +396,7 @@ void TabbedArea::setSelectedTab(Tab *const tab) } } - Tab *const newTab = dynamic_cast<Tab *const>(tab); + Tab *const newTab = tab; if (newTab) newTab->setCurrent(); diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp index 9a48fec7c..81bcd5e6b 100644 --- a/src/gui/windowmenu.cpp +++ b/src/gui/windowmenu.cpp @@ -197,7 +197,7 @@ WindowMenu::~WindowMenu() mButtonNames.clear(); FOR_EACH (std::vector <Button*>::iterator, it, mButtons) { - Button *const btn = dynamic_cast<Button*>(*it); + Button *const btn = *it; if (!btn) continue; if (!btn->isVisibleLocal()) @@ -321,8 +321,7 @@ void WindowMenu::mouseExited(MouseEvent& event A_UNUSED) void WindowMenu::showButton(const std::string &name, const bool visible) { - const ButtonInfo *const info = dynamic_cast<ButtonInfo *const>( - mButtonNames[name]); + const ButtonInfo *const info = mButtonNames[name]; if (!info || !info->button) return; @@ -340,7 +339,7 @@ void WindowMenu::updateButtons() const int pad2 = 2 * mPadding; FOR_EACH (std::vector <Button*>::iterator, it, mButtons) { - Button *const btn = dynamic_cast<Button *const>(*it); + Button *const btn = *it; if (!btn) continue; if (btn->isVisibleLocal()) @@ -381,8 +380,7 @@ void WindowMenu::loadButtons() "windowmenu" + toString(f), ""); if (str.empty() || str == "SET") continue; - const ButtonInfo *const info = dynamic_cast<ButtonInfo *const>( - mButtonNames[str]); + const ButtonInfo *const info = mButtonNames[str]; if (!info || !info->button) continue; info->button->setVisible(false); @@ -410,7 +408,7 @@ void WindowMenu::saveButtons() const int i = 0; FOR_EACH (std::vector <Button*>::const_iterator, it, mButtons) { - const Button *const btn = dynamic_cast<const Button *const>(*it); + const Button *const btn = *it; if (btn && !btn->isVisibleLocal()) { config.setValue("windowmenu" + toString(i), diff --git a/src/gui/windows/botcheckerwindow.cpp b/src/gui/windows/botcheckerwindow.cpp index 9f1973426..e79a852cb 100644 --- a/src/gui/windows/botcheckerwindow.cpp +++ b/src/gui/windows/botcheckerwindow.cpp @@ -190,12 +190,11 @@ void BotCheckerWindow::reset() std::set<ActorSprite*> beings = actorManager->getAll(); FOR_EACH (ActorSprites::iterator, i, beings) { - Being *const being = dynamic_cast<Being*>(*i); - - if (being && being->getType() == ActorType::Player - && being != localPlayer && being->getName() != "") + if ((*i)->getType() == ActorType::Player) { - being->resetCounters(); + Being *const being = static_cast<Being*>(*i); + if (being != localPlayer && !being->getName().empty()) + being->resetCounters(); } } } diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index b423767c5..5db4b9bfd 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -605,8 +605,7 @@ void ChatWindow::ignoreAllWhispers() iter != mWhispers.end(); ++ iter) { - WhisperTab *const tab = dynamic_cast<WhisperTab* const>( - iter->second); + WhisperTab *const tab = iter->second; if (tab) { if (player_relations.getRelation(tab->getNick()) diff --git a/src/net/eathena/gamehandler.cpp b/src/net/eathena/gamehandler.cpp index 989aa0665..2f425b52c 100644 --- a/src/net/eathena/gamehandler.cpp +++ b/src/net/eathena/gamehandler.cpp @@ -199,7 +199,7 @@ void GameHandler::processMapLogin(Net::MessageIn &msg) mLastHost &= 0xffffff; - GameHandler *const g = dynamic_cast<GameHandler*>(gameHandler); + GameHandler *const g = static_cast<GameHandler*>(gameHandler); if (g) { Network *const network = g->mNetwork; diff --git a/src/net/tmwa/gamehandler.cpp b/src/net/tmwa/gamehandler.cpp index 544b93802..f804b61f2 100644 --- a/src/net/tmwa/gamehandler.cpp +++ b/src/net/tmwa/gamehandler.cpp @@ -180,7 +180,7 @@ void GameHandler::processMapLogin(Net::MessageIn &msg) mLastHost &= 0xffffff; - GameHandler *const g = dynamic_cast<GameHandler*>(gameHandler); + GameHandler *const g = static_cast<GameHandler*>(gameHandler); if (g) { Network *const network = g->mNetwork; |