summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-02-25 21:28:51 +0300
committerAndrei Karas <akaras@inbox.ru>2012-02-25 21:46:40 +0300
commit81db0022e50e25d922ac7d67d9ec6017b8856f13 (patch)
tree0ead8c5df5b8eb00cbe5e07e2f7dc36170786846 /src/gui
parent6317f3e0c1e2c6d2e88dd99443e7f45f7bb77f44 (diff)
downloadmv-81db0022e50e25d922ac7d67d9ec6017b8856f13.tar.gz
mv-81db0022e50e25d922ac7d67d9ec6017b8856f13.tar.bz2
mv-81db0022e50e25d922ac7d67d9ec6017b8856f13.tar.xz
mv-81db0022e50e25d922ac7d67d9ec6017b8856f13.zip
Fix old casts.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/charcreatedialog.cpp10
-rw-r--r--src/gui/debugwindow.cpp2
-rw-r--r--src/gui/editserverdialog.cpp3
-rw-r--r--src/gui/equipmentwindow.cpp10
-rw-r--r--src/gui/itempopup.cpp2
-rw-r--r--src/gui/outfitwindow.cpp2
-rw-r--r--src/gui/popupmenu.cpp2
-rw-r--r--src/gui/serverdialog.cpp4
-rw-r--r--src/gui/setup_relations.cpp2
-rw-r--r--src/gui/updaterwindow.cpp4
-rw-r--r--src/gui/viewport.cpp3
-rw-r--r--src/gui/widgets/browserbox.cpp22
-rw-r--r--src/gui/widgets/guitable.cpp9
-rw-r--r--src/gui/widgets/setupitem.cpp4
-rw-r--r--src/gui/widgets/textfield.cpp2
15 files changed, 48 insertions, 33 deletions
diff --git a/src/gui/charcreatedialog.cpp b/src/gui/charcreatedialog.cpp
index 8d4767a15..9f7436ad8 100644
--- a/src/gui/charcreatedialog.cpp
+++ b/src/gui/charcreatedialog.cpp
@@ -474,8 +474,11 @@ void CharCreateDialog::updateHair()
mHairStyle %= Being::getNumOfHairstyles();
if (mHairStyle < 0)
mHairStyle += Being::getNumOfHairstyles();
- if (mHairStyle < (signed)minHairStyle || mHairStyle > (signed)maxHairStyle)
+ if (mHairStyle < static_cast<signed>(minHairStyle)
+ || mHairStyle > static_cast<signed>(maxHairStyle))
+ {
mHairStyle = minHairStyle;
+ }
const ItemInfo &item = ItemDB::get(-mHairStyle);
mHairStyleNameLabel->setCaption(item.getName());
mHairStyleNameLabel->adjustSize();
@@ -483,8 +486,11 @@ void CharCreateDialog::updateHair()
mHairColor %= ColorDB::getHairSize();
if (mHairColor < 0)
mHairColor += ColorDB::getHairSize();
- if (mHairColor < (signed)minHairColor || mHairColor > (signed)maxHairColor)
+ if (mHairColor < static_cast<signed>(minHairColor)
+ || mHairColor > static_cast<signed>(maxHairColor))
+ {
mHairColor = minHairColor;
+ }
mHairColorNameLabel->setCaption(ColorDB::getHairColorName(mHairColor));
mHairColorNameLabel->adjustSize();
diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp
index b65068dc5..fa01b5aa8 100644
--- a/src/gui/debugwindow.cpp
+++ b/src/gui/debugwindow.cpp
@@ -390,7 +390,7 @@ void NetDebugTab::logic()
if (player_node && player_node->getPingTime() != 0)
{
mPingLabel->setCaption(strprintf(_("Ping: %s ms"),
- toString((int)player_node->getPingTime()).c_str()));
+ toString(static_cast<int>(player_node->getPingTime())).c_str()));
}
else
{
diff --git a/src/gui/editserverdialog.cpp b/src/gui/editserverdialog.cpp
index 8a4a9579d..53e31c3c8 100644
--- a/src/gui/editserverdialog.cpp
+++ b/src/gui/editserverdialog.cpp
@@ -184,7 +184,8 @@ void EditServerDialog::action(const gcn::ActionEvent &event)
mServer.name = mNameField->getText();
mServer.description = mDescriptionField->getText();
mServer.hostname = mServerAddressField->getText();
- mServer.port = (short) atoi(mPortField->getText().c_str());
+ mServer.port = static_cast<short>(atoi(
+ mPortField->getText().c_str()));
if (mTypeField)
{
diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp
index 275bf19bb..89063c3dc 100644
--- a/src/gui/equipmentwindow.cpp
+++ b/src/gui/equipmentwindow.cpp
@@ -407,8 +407,11 @@ void EquipmentWindow::loadSlot(XmlNodePtr slotNode, ImageSet *imageset)
const int imageIndex = XML::getProperty(slotNode, "image", -1);
Image *image = nullptr;
- if (imageset && imageIndex >= 0 && imageIndex < (signed)imageset->size())
+ if (imageset && imageIndex >= 0 && imageIndex
+ < static_cast<signed>(imageset->size()))
+ {
image = imageset->get(imageIndex);
+ }
if (mBoxes[slot])
{
@@ -510,8 +513,11 @@ void EquipmentWindow::addBox(int idx, int x, int y, int imageIndex)
{
Image *image = nullptr;
- if (mImageSet && imageIndex >= 0 && imageIndex < (signed)mImageSet->size())
+ if (mImageSet && imageIndex >= 0 && imageIndex
+ < static_cast<signed>(mImageSet->size()))
+ {
image = mImageSet->get(imageIndex);
+ }
mBoxes[idx] = new EquipmentBox(x + getPadding(), y + getTitleBarHeight(),
image);
diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp
index d96aa564f..f33f77e83 100644
--- a/src/gui/itempopup.cpp
+++ b/src/gui/itempopup.cpp
@@ -123,7 +123,7 @@ void ItemPopup::setItem(const Item *item, bool showImage)
}
mItemName->adjustSize();
unsigned minWidth = mItemName->getWidth() + 8;
- if ((unsigned)getWidth() < minWidth)
+ if (static_cast<unsigned>(getWidth()) < minWidth)
setWidth(minWidth);
}
}
diff --git a/src/gui/outfitwindow.cpp b/src/gui/outfitwindow.cpp
index 73484f1d5..6eaa2ac4e 100644
--- a/src/gui/outfitwindow.cpp
+++ b/src/gui/outfitwindow.cpp
@@ -190,7 +190,7 @@ void OutfitWindow::save()
outfitStr += toString(res);
if (i < OUTFIT_ITEM_COUNT - 1)
outfitStr += " ";
- outfitColorsStr += toString((int)mItemColors[o][i]);
+ outfitColorsStr += toString(static_cast<int>(mItemColors[o][i]));
if (i < OUTFIT_ITEM_COUNT - 1)
outfitColorsStr += " ";
}
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index c987843d3..933d2c7cd 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -2205,7 +2205,7 @@ void PlayerListener::action(const gcn::ActionEvent &event)
{
std::string comment = mDialog->getText();
Being* being = actorSpriteManager->findBeingByName(
- mNick, (ActorSprite::Type)mType);
+ mNick, static_cast<ActorSprite::Type>(mType));
if (being)
being->setComment(comment);
Being::saveComment(mNick, comment, mType);
diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp
index da61e105b..ed9696892 100644
--- a/src/gui/serverdialog.cpp
+++ b/src/gui/serverdialog.cpp
@@ -125,7 +125,7 @@ std::string ServersListModel::getElementAt(int elementIndex)
void ServersListModel::setVersionString(int index, const std::string &version)
{
- if (index >= (int)mVersionStrings.size())
+ if (index >= static_cast<int>(mVersionStrings.size()))
return;
if (version.empty())
@@ -632,7 +632,7 @@ void ServerDialog::saveCustomServers(const ServerInfo &currentServer,
// Make sure the current server is mentioned first
if (currentServer.isValid())
{
- if (index >= 0 && (unsigned)index < mServers.size())
+ if (index >= 0 && static_cast<unsigned>(index) < mServers.size())
{
mServers[index] = currentServer;
}
diff --git a/src/gui/setup_relations.cpp b/src/gui/setup_relations.cpp
index 47d53620c..f3b664c9b 100644
--- a/src/gui/setup_relations.cpp
+++ b/src/gui/setup_relations.cpp
@@ -194,7 +194,7 @@ public:
std::string getPlayerAt(int index) const
{
- if (index < 0 || index >= (signed)mPlayers->size())
+ if (index < 0 || index >= static_cast<signed>(mPlayers->size()))
return "";
return (*mPlayers)[index];
}
diff --git a/src/gui/updaterwindow.cpp b/src/gui/updaterwindow.cpp
index 3aaf93557..fe26d42eb 100644
--- a/src/gui/updaterwindow.cpp
+++ b/src/gui/updaterwindow.cpp
@@ -554,8 +554,8 @@ void UpdaterWindow::logic()
if (mUpdateFiles.size() && mUpdateIndex <= mUpdateFiles.size())
{
mProgressBar->setText(strprintf("%d/%d", mUpdateIndex
- + mUpdateIndexOffset + 1, (int)mUpdateFiles.size()
- + (int)mTempUpdateFiles.size() + 1));
+ + mUpdateIndexOffset + 1, static_cast<int>(mUpdateFiles.size())
+ + static_cast<int>(mTempUpdateFiles.size()) + 1));
}
else
{
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index d4c188bfb..0c0f0d3d9 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -199,7 +199,8 @@ void Viewport::draw(gcn::Graphics *gcnGraphics)
// if (debugChatTab)
// debugChatTab->chatLog("incorrect player position!");
logger->log("incorrect player position: %d, %d, %d, %d",
- player_x, player_y, (int)mPixelViewX, (int)mPixelViewY);
+ player_x, player_y, static_cast<int>(mPixelViewX),
+ static_cast<int>(mPixelViewY));
if (player_node)
{
logger->log("tile position: %d, %d",
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp
index 5856a91b1..47c5616b6 100644
--- a/src/gui/widgets/browserbox.cpp
+++ b/src/gui/widgets/browserbox.cpp
@@ -232,15 +232,17 @@ void BrowserBox::addRow(const std::string &row, bool atTop)
tempRow.substr(nextChar,
(nextSpacePos - nextChar)));
- if ((x + nextWordWidth + 10) > (unsigned)getWidth())
+ if ((x + nextWordWidth + 10)
+ > static_cast<unsigned>(getWidth()))
{
x = 15; // Ident in new line
y += 1;
- j++;
+ j ++;
}
}
// Wrapping looong lines (brutal force)
- else if ((x + 2 * hyphenWidth) > (unsigned)getWidth())
+ else if ((x + 2 * hyphenWidth)
+ > static_cast<unsigned>(getWidth()))
{
x = 15; // Ident in new line
y += 1;
@@ -249,7 +251,7 @@ void BrowserBox::addRow(const std::string &row, bool atTop)
}
setHeight(font->getHeight() * (static_cast<int>(
- mTextRows.size()) + y));
+ mTextRows.size()) + y));
}
else
{
@@ -423,7 +425,7 @@ int BrowserBox::calcHeight()
if (row.find("---", 0) == 0)
{
const int dashWidth = fontWidthMinus;
- for (x = 0; x < (unsigned)getWidth(); x++)
+ for (x = 0; x < static_cast<unsigned>(getWidth()); x ++)
{
mLineParts.push_back(LinePart(x, y, selColor, "-", false));
x += dashWidth - 2;
@@ -557,9 +559,8 @@ int BrowserBox::calcHeight()
width = font->getWidth(part);
// Auto wrap mode
- if (mMode == AUTO_WRAP && getWidth() > 0
- && width > 0
- && (x + width + 10) > (unsigned)getWidth())
+ if (mMode == AUTO_WRAP && getWidth() > 0 && width > 0
+ && (x + width + 10) > static_cast<unsigned>(getWidth()))
{
bool forced = false;
@@ -592,9 +593,8 @@ int BrowserBox::calcHeight()
else
width = font->getWidth(part);
}
- while (end > start && width > 0
- && (x + width + 10)
- > (unsigned)getWidth());
+ while (end > start && width > 0 && (x + width + 10)
+ > static_cast<unsigned>(getWidth()));
if (forced)
{
diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp
index d620cbb8d..6434f5453 100644
--- a/src/gui/widgets/guitable.cpp
+++ b/src/gui/widgets/guitable.cpp
@@ -348,14 +348,15 @@ void GuiTable::draw(gcn::Graphics* graphics)
if (mSelectedRow > 0)
{
- if (mLinewiseMode && r == (unsigned)mSelectedRow && c == 0)
+ if (mLinewiseMode && r == static_cast<unsigned>(
+ mSelectedRow) && c == 0)
{
graphics->fillRectangle(gcn::Rectangle(0, y_offset,
- getWidth(), height));
+ getWidth(), height));
}
else if (!mLinewiseMode && mSelectedColumn > 0
- && c == (unsigned)mSelectedColumn
- && r == (unsigned)mSelectedRow)
+ && c == static_cast<unsigned>(mSelectedColumn)
+ && r == static_cast<unsigned>(mSelectedRow))
{
graphics->fillRectangle(gcn::Rectangle(
x_offset, y_offset, width, height));
diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp
index 490c046c3..8987719da 100644
--- a/src/gui/widgets/setupitem.cpp
+++ b/src/gui/widgets/setupitem.cpp
@@ -830,8 +830,8 @@ void SetupItemSlider2::updateLabel()
int val = mSlider->getValue() - mMin;
if (val < 0)
val = 0;
- else if (val >= (signed)mValues->size())
- val = (signed)mValues->size() - 1;
+ else if (val >= static_cast<signed>(mValues->size()))
+ val = static_cast<signed>(mValues->size()) - 1;
std::string str = mValues->at(val);
mLabel2->setCaption(str);
}
diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp
index e207b0613..a90712340 100644
--- a/src/gui/widgets/textfield.cpp
+++ b/src/gui/widgets/textfield.cpp
@@ -183,7 +183,7 @@ int TextField::getValue() const
if (value < mMinimum)
return mMinimum;
- if (value > (signed)mMaximum)
+ if (value > static_cast<signed>(mMaximum))
return mMaximum;
return value;