summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/charselectdialog.cpp13
-rw-r--r--src/gui/chat.cpp2
-rw-r--r--src/gui/gui.cpp5
-rw-r--r--src/gui/minimap.cpp2
-rw-r--r--src/gui/npcdialog.cpp2
-rw-r--r--src/gui/serverdialog.cpp4
-rw-r--r--src/gui/setup_video.cpp4
-rw-r--r--src/gui/specialswindow.cpp7
-rw-r--r--src/gui/truetypefont.cpp5
-rw-r--r--src/gui/widgets/browserbox.cpp5
-rw-r--r--src/gui/widgets/chattab.cpp3
-rw-r--r--src/gui/widgets/emoteshortcutcontainer.cpp4
-rw-r--r--src/gui/widgets/shopitems.cpp5
-rw-r--r--src/gui/widgets/shortcutcontainer.cpp2
-rw-r--r--src/gui/widgets/tabbedarea.cpp2
-rw-r--r--src/gui/widgets/window.cpp5
16 files changed, 40 insertions, 30 deletions
diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp
index e437c029a..bff000ef3 100644
--- a/src/gui/charselectdialog.cpp
+++ b/src/gui/charselectdialog.cpp
@@ -160,10 +160,11 @@ CharSelectDialog::CharSelectDialog(LoginData *loginData):
place = getPlacer(0, 1);
- for (int i = 0; i < (int)mLoginData->characterSlots; i++)
+ for (int i = 0; i < static_cast<int>(mLoginData->characterSlots); i++)
{
mCharacterEntries.push_back(new CharacterDisplay(this));
- place(i % SLOTS_PER_ROW, (int)i / SLOTS_PER_ROW, mCharacterEntries[i]);
+ place(i % SLOTS_PER_ROW, static_cast<int>(i) / SLOTS_PER_ROW,
+ mCharacterEntries[i]);
}
reflowLayout();
@@ -187,7 +188,7 @@ void CharSelectDialog::action(const gcn::ActionEvent &event)
// Check if a button of a character was pressed
const gcn::Widget *sourceParent = event.getSource()->getParent();
int selected = -1;
- for (int i = 0; i < (int)mCharacterEntries.size(); ++i)
+ for (int i = 0; i < static_cast<int>(mCharacterEntries.size()); ++i)
{
if (mCharacterEntries[i] == sourceParent)
{
@@ -297,7 +298,7 @@ void CharSelectDialog::setCharacters(const Net::Characters &characters)
if (Net::getNetworkType() == ServerInfo::MANASERV && characterSlot > 0)
--characterSlot;
- if (characterSlot >= (int)mCharacterEntries.size())
+ if (characterSlot >= static_cast<int>(mCharacterEntries.size()))
{
logger->log("Warning: slot out of range: %d", character->slot);
continue;
@@ -331,7 +332,7 @@ void CharSelectDialog::setLocked(bool locked)
if (mChangeEmailButton)
mChangeEmailButton->setEnabled(!locked);
- for (int i = 0; i < (int)mCharacterEntries.size(); ++i)
+ for (int i = 0; i < static_cast<int>(mCharacterEntries.size()); ++i)
{
if (mCharacterEntries[i])
mCharacterEntries[i]->setActive(!mLocked);
@@ -344,7 +345,7 @@ bool CharSelectDialog::selectByName(const std::string &name,
if (mLocked)
return false;
- for (int i = 0; i < (int)mCharacterEntries.size(); ++i)
+ for (int i = 0; i < static_cast<int>(mCharacterEntries.size()); ++i)
{
Net::Character *character = mCharacterEntries[i]->getCharacter();
if (mCharacterEntries[i] && character)
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 399202b70..6815796ff 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -367,7 +367,7 @@ void ChatWindow::nextTab()
void ChatWindow::defaultTab()
{
if (mChatTabs)
- mChatTabs->setSelectedTab((unsigned)0);
+ mChatTabs->setSelectedTab(static_cast<unsigned>(0));
}
void ChatWindow::action(const gcn::ActionEvent &event)
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index 3813c050f..baccb7796 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -344,8 +344,7 @@ void Gui::distributeMouseEvent(gcn::Widget* source, int type, int button,
if (!gcn::Widget::widgetExists(widget))
break;
- parent = (gcn::Widget*)widget->getParent();
-
+ parent = static_cast<gcn::Widget*>(widget->getParent());
if (widget->isEnabled() || force)
{
@@ -403,7 +402,7 @@ void Gui::distributeMouseEvent(gcn::Widget* source, int type, int button,
gcn::Widget* swap = widget;
widget = parent;
- parent = (gcn::Widget*)swap->getParent();
+ parent = static_cast<gcn::Widget*>(swap->getParent());
// If a non modal focused widget has been reach
// and we have modal focus cancel the distribution.
diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp
index 197c92ee3..de9d2a150 100644
--- a/src/gui/minimap.cpp
+++ b/src/gui/minimap.cpp
@@ -111,7 +111,7 @@ void Minimap::setMap(Map *map)
// I'm not sure if the locks are necessary since it's a SWSURFACE
SDL_LockSurface(surface);
- int* data = (int*)surface->pixels;
+ int* data = static_cast<int*>(surface->pixels);
if (!data)
{
if (!isSticky())
diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp
index e61bb120f..af89a6881 100644
--- a/src/gui/npcdialog.cpp
+++ b/src/gui/npcdialog.cpp
@@ -77,7 +77,7 @@ NpcDialog::NpcDialog(int npcId)
// Setup output text box
mTextBox = new BrowserBox(BrowserBox::AUTO_WRAP);
mTextBox->setOpaque(false);
- mTextBox->setMaxRow((int) config.getIntValue("ChatLogLength"));
+ mTextBox->setMaxRow(static_cast<int>(config.getIntValue("ChatLogLength")));
mTextBox->setLinkHandler(mItemLinkHandler);
mScrollArea = new ScrollArea(mTextBox);
diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp
index c89c7846b..b9f0bc6f5 100644
--- a/src/gui/serverdialog.cpp
+++ b/src/gui/serverdialog.cpp
@@ -620,8 +620,8 @@ void ServerDialog::loadServers(bool addNew)
}
else if (xmlStrEqual(subNode->name, BAD_CAST "description"))
{
- server.description =
- (const char*)subNode->xmlChildrenNode->content;
+ server.description = reinterpret_cast<const char*>(
+ subNode->xmlChildrenNode->content);
}
}
diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp
index 97b973afe..543d7aa8d 100644
--- a/src/gui/setup_video.cpp
+++ b/src/gui/setup_video.cpp
@@ -110,7 +110,7 @@ ModeListModel::ModeListModel()
{
logger->log1("No modes available");
}
- else if (modes == (SDL_Rect **)-1)
+ else if (modes == reinterpret_cast<SDL_Rect **>(-1))
{
logger->log1("All resolutions available");
}
@@ -767,7 +767,7 @@ void Setup_Video::action(const gcn::ActionEvent &event)
mSpeechSlider->getValue());
mSpeechLabel->setCaption(speechModeToString(val));
mSpeechSlider->setValue(val);
- config.setValue("speech", (int)val);
+ config.setValue("speech", static_cast<int>(val));
}
else if (id == "lognpc")
{
diff --git a/src/gui/specialswindow.cpp b/src/gui/specialswindow.cpp
index b2c57775f..51d31f2c9 100644
--- a/src/gui/specialswindow.cpp
+++ b/src/gui/specialswindow.cpp
@@ -237,8 +237,8 @@ SpecialEntry::SpecialEntry(SpecialInfo *info) :
float progress = 0;
if (info->rechargeNeeded)
{
- progress = (float)info->rechargeCurrent
- / (float)info->rechargeNeeded;
+ progress = static_cast<float>(info->rechargeCurrent)
+ / static_cast<float>(info->rechargeNeeded);
}
mRechargeBar = new ProgressBar(progress, 100, 10, Theme::PROG_MP);
mRechargeBar->setSmoothProgress(false);
@@ -252,7 +252,8 @@ void SpecialEntry::update(int current, int needed)
{
if (mRechargeBar && needed)
{
- float progress = (float)current / (float)needed;
+ float progress = static_cast<float>(current)
+ / static_cast<float>(needed);
mRechargeBar->setProgress(progress);
}
}
diff --git a/src/gui/truetypefont.cpp b/src/gui/truetypefont.cpp
index a25f4748a..62003d94c 100644
--- a/src/gui/truetypefont.cpp
+++ b/src/gui/truetypefont.cpp
@@ -173,8 +173,11 @@ void TrueTypeFont::loadFont(const std::string &filename, int size, int style)
void TrueTypeFont::clear()
{
- for (unsigned short f = 0; f < (unsigned short)CACHES_NUMBER; f ++)
+ for (unsigned short f = 0; f < static_cast<unsigned short>(
+ CACHES_NUMBER); f ++)
+ {
mCache[static_cast<unsigned short>(f)].clear();
+ }
}
void TrueTypeFont::drawString(gcn::Graphics *graphics,
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp
index eaeed4d06..8546cbd7e 100644
--- a/src/gui/widgets/browserbox.cpp
+++ b/src/gui/widgets/browserbox.cpp
@@ -290,7 +290,8 @@ void BrowserBox::draw(gcn::Graphics *graphics)
graphics->fillRectangle(gcn::Rectangle(0, 0, getWidth(), getHeight()));
}
- if (mSelectedLink >= 0 && mSelectedLink < (signed)mLinks.size())
+ if (mSelectedLink >= 0 && mSelectedLink
+ < static_cast<signed>(mLinks.size()))
{
if ((mHighMode & BACKGROUND))
{
@@ -434,7 +435,7 @@ int BrowserBox::calcHeight()
}
}
- if (c == '<' && link < (signed)mLinks.size())
+ if (c == '<' && link < static_cast<signed>(mLinks.size()))
{
const int size =
font->getWidth(mLinks[link].caption) + 1;
diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp
index 736594859..9675eb621 100644
--- a/src/gui/widgets/chattab.cpp
+++ b/src/gui/widgets/chattab.cpp
@@ -56,7 +56,8 @@ ChatTab::ChatTab(const std::string &name) :
mTextOutput = new BrowserBox(BrowserBox::AUTO_WRAP);
mTextOutput->setOpaque(false);
- mTextOutput->setMaxRow((int) config.getIntValue("ChatLogLength"));
+ mTextOutput->setMaxRow(static_cast<int>(
+ config.getIntValue("ChatLogLength")));
if (chatWindow)
mTextOutput->setLinkHandler(chatWindow->mItemLinkHandler);
mTextOutput->setAlwaysUpdate(false);
diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp
index 4abe279da..f6762a5cb 100644
--- a/src/gui/widgets/emoteshortcutcontainer.cpp
+++ b/src/gui/widgets/emoteshortcutcontainer.cpp
@@ -131,7 +131,7 @@ void EmoteShortcutContainer::draw(gcn::Graphics *graphics)
mEmoteImg[i]->sprite->draw(g, emoteX + 2, emoteY + 10);
}
- if (mEmoteMoved && mEmoteMoved < (unsigned)mEmoteImg.size() + 1
+ if (mEmoteMoved && mEmoteMoved < static_cast<unsigned>(mEmoteImg.size()) + 1
&& mEmoteMoved > 0)
{
// Draw the emote image being dragged by the cursor.
@@ -245,7 +245,7 @@ void EmoteShortcutContainer::mouseMoved(gcn::MouseEvent &event)
mEmotePopup->setVisible(false);
- if ((unsigned)index < mEmoteImg.size() && mEmoteImg[index])
+ if (static_cast<unsigned>(index) < mEmoteImg.size() && mEmoteImg[index])
{
mEmotePopup->show(viewport->getMouseX(), viewport->getMouseY(),
mEmoteImg[index]->name);
diff --git a/src/gui/widgets/shopitems.cpp b/src/gui/widgets/shopitems.cpp
index 15f4292a5..6cd0ef39d 100644
--- a/src/gui/widgets/shopitems.cpp
+++ b/src/gui/widgets/shopitems.cpp
@@ -43,8 +43,11 @@ int ShopItems::getNumberOfElements()
std::string ShopItems::getElementAt(int i)
{
- if (i < 0 || (unsigned)i >= mShopItems.size() || !mShopItems.at(i))
+ if (i < 0 || static_cast<unsigned>(i) >= mShopItems.size()
+ || !mShopItems.at(i))
+ {
return "";
+ }
return mShopItems.at(i)->getDisplayName();
}
diff --git a/src/gui/widgets/shortcutcontainer.cpp b/src/gui/widgets/shortcutcontainer.cpp
index dd5dcf95a..a804f2658 100644
--- a/src/gui/widgets/shortcutcontainer.cpp
+++ b/src/gui/widgets/shortcutcontainer.cpp
@@ -65,7 +65,7 @@ int ShortcutContainer::getIndexFromGrid(int pointX, int pointY) const
int index = ((pointY / mBoxHeight) * mGridWidth) + pointX / mBoxWidth;
if (!tRect.isPointInRect(pointX, pointY) ||
- index >= (int)mMaxItems || index < 0)
+ index >= static_cast<int>(mMaxItems) || index < 0)
{
index = -1;
}
diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp
index ca3eb5095..67882deca 100644
--- a/src/gui/widgets/tabbedarea.cpp
+++ b/src/gui/widgets/tabbedarea.cpp
@@ -155,7 +155,7 @@ void TabbedArea::removeTab(Tab *tab)
}
}
- if (tabIndexToBeSelected >= (signed)mTabs.size())
+ if (tabIndexToBeSelected >= static_cast<signed>(mTabs.size()))
tabIndexToBeSelected = mTabs.size() - 1;
if (tabIndexToBeSelected < -1)
tabIndexToBeSelected = -1;
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index 9b05a1389..1037296b6 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -748,7 +748,8 @@ int Window::getResizeHandles(gcn::MouseEvent &event)
const int y = event.getY();
if (mGrip && (y > static_cast<int>(mTitleBarHeight)
- || (y < (int)getPadding() && mTitleBarHeight > getPadding())))
+ || (y < static_cast<int>(getPadding()) && mTitleBarHeight
+ > getPadding())))
{
const int x = event.getX();
@@ -776,7 +777,7 @@ bool Window::isResizeAllowed(gcn::MouseEvent &event)
const int y = event.getY();
if (mGrip && (y > static_cast<int>(mTitleBarHeight)
- || y < (int)getPadding()))
+ || y < static_cast<int>(getPadding())))
{
const int x = event.getX();