summaryrefslogtreecommitdiff
path: root/src/gui/windows
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-02-07 16:18:13 +0300
committerAndrei Karas <akaras@inbox.ru>2016-02-07 16:18:13 +0300
commit9fe21fcd8883b37bdc30224822e6e42afb35b8f0 (patch)
tree798117abd4dc7e610997d59d530a96ddc1509f53 /src/gui/windows
parent4429cb14e9e187edef27aba692a4266733f79c17 (diff)
downloadmv-9fe21fcd8883b37bdc30224822e6e42afb35b8f0.tar.gz
mv-9fe21fcd8883b37bdc30224822e6e42afb35b8f0.tar.bz2
mv-9fe21fcd8883b37bdc30224822e6e42afb35b8f0.tar.xz
mv-9fe21fcd8883b37bdc30224822e6e42afb35b8f0.zip
Replace most static_cast<Type> to shorter versions from defines.
Diffstat (limited to 'src/gui/windows')
-rw-r--r--src/gui/windows/buydialog.cpp2
-rw-r--r--src/gui/windows/charcreatedialog.cpp26
-rw-r--r--src/gui/windows/charselectdialog.cpp24
-rw-r--r--src/gui/windows/chatwindow.cpp36
-rw-r--r--src/gui/windows/editserverdialog.cpp2
-rw-r--r--src/gui/windows/emotewindow.cpp4
-rw-r--r--src/gui/windows/equipmentwindow.cpp6
-rw-r--r--src/gui/windows/itemamountwindow.cpp10
-rw-r--r--src/gui/windows/logindialog.cpp4
-rw-r--r--src/gui/windows/mailwindow.cpp2
-rw-r--r--src/gui/windows/minimap.cpp16
-rw-r--r--src/gui/windows/ministatuswindow.cpp4
-rw-r--r--src/gui/windows/npcdialog.cpp12
-rw-r--r--src/gui/windows/outfitwindow.cpp34
-rw-r--r--src/gui/windows/questswindow.cpp4
-rw-r--r--src/gui/windows/quitdialog.cpp2
-rw-r--r--src/gui/windows/registerdialog.cpp2
-rw-r--r--src/gui/windows/serverdialog.cpp12
-rw-r--r--src/gui/windows/skilldialog.cpp8
-rw-r--r--src/gui/windows/textcommandeditor.cpp4
-rw-r--r--src/gui/windows/textdialog.cpp2
-rw-r--r--src/gui/windows/textselectdialog.cpp2
-rw-r--r--src/gui/windows/updaterwindow.cpp32
-rw-r--r--src/gui/windows/whoisonline.cpp8
24 files changed, 129 insertions, 129 deletions
diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp
index 644e8c5ce..82f49421b 100644
--- a/src/gui/windows/buydialog.cpp
+++ b/src/gui/windows/buydialog.cpp
@@ -482,7 +482,7 @@ void BuyDialog::action(const ActionEvent &event)
if (eventId == "slider")
{
- mAmountItems = static_cast<int>(mSlider->getValue());
+ mAmountItems = CAST_S32(mSlider->getValue());
mAmountField->setValue(mAmountItems);
updateButtonsAndLabels();
}
diff --git a/src/gui/windows/charcreatedialog.cpp b/src/gui/windows/charcreatedialog.cpp
index 6e8120373..0f693aa45 100644
--- a/src/gui/windows/charcreatedialog.cpp
+++ b/src/gui/windows/charcreatedialog.cpp
@@ -163,7 +163,7 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent,
if (maxHairStyle)
{
- mHairStyle = (static_cast<unsigned int>(rand())
+ mHairStyle = (CAST_U32(rand())
% maxHairStyle) + minHairStyle;
}
else
@@ -172,7 +172,7 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent,
}
if (maxHairColor)
{
- mHairColor = (static_cast<unsigned int>(rand())
+ mHairColor = (CAST_U32(rand())
% maxHairColor) + minHairColor;
}
else
@@ -440,7 +440,7 @@ void CharCreateDialog::action(const ActionEvent &event)
std::vector<int> atts;
for (size_t i = 0, sz = mAttributeSlider.size(); i < sz; i++)
{
- atts.push_back(static_cast<int>(
+ atts.push_back(CAST_S32(
mAttributeSlider[i]->getValue()));
}
@@ -451,8 +451,8 @@ void CharCreateDialog::action(const ActionEvent &event)
mGender,
mHairStyle,
mHairColor,
- static_cast<unsigned char>(mRace),
- static_cast<unsigned char>(mLook),
+ CAST_U8(mRace),
+ CAST_U8(mLook),
atts);
}
else
@@ -568,7 +568,7 @@ void CharCreateDialog::updateSliders()
{
// Update captions
mAttributeValue[i]->setCaption(
- toString(static_cast<int>(mAttributeSlider[i]->getValue())));
+ toString(CAST_S32(mAttributeSlider[i]->getValue())));
mAttributeValue[i]->adjustSize();
}
@@ -610,7 +610,7 @@ int CharCreateDialog::getDistributedPoints() const
int points = 0;
for (size_t i = 0, sz = mAttributeSlider.size(); i < sz; i++)
- points += static_cast<int>(mAttributeSlider[i]->getValue());
+ points += CAST_S32(mAttributeSlider[i]->getValue());
return points;
}
@@ -642,7 +642,7 @@ void CharCreateDialog::setAttributes(const StringVect &labels,
if (serverFeatures->haveRaceSelection() && mMinRace < mMaxRace)
y += 29;
- for (unsigned i = 0, sz = static_cast<unsigned>(labels.size());
+ for (unsigned i = 0, sz = CAST_U32(labels.size());
i < sz; i++)
{
mAttributeLabel[i] = new Label(this, labels[i]);
@@ -704,8 +704,8 @@ void CharCreateDialog::updateHair()
mHairStyle = Being::getNumOfHairstyles() - 1;
else
mHairStyle %= Being::getNumOfHairstyles();
- if (mHairStyle < static_cast<signed>(minHairStyle)
- || mHairStyle > static_cast<signed>(maxHairStyle))
+ if (mHairStyle < CAST_S32(minHairStyle)
+ || mHairStyle > CAST_S32(maxHairStyle))
{
mHairStyle = minHairStyle;
}
@@ -722,8 +722,8 @@ void CharCreateDialog::updateHair()
mHairColor = 0;
if (mHairColor < 0)
mHairColor += ColorDB::getHairSize();
- if (mHairColor < static_cast<signed>(minHairColor)
- || mHairColor > static_cast<signed>(maxHairColor))
+ if (mHairColor < CAST_S32(minHairColor)
+ || mHairColor > CAST_S32(maxHairColor))
{
mHairColor = minHairColor;
}
@@ -767,7 +767,7 @@ void CharCreateDialog::updateLook()
mLook = 0;
}
mPlayer->setSubtype(fromInt(mRace, BeingTypeId),
- static_cast<uint8_t>(mLook));
+ CAST_U8(mLook));
if (mRaceNameLabel)
{
mRaceNameLabel->setCaption(item.getName());
diff --git a/src/gui/windows/charselectdialog.cpp b/src/gui/windows/charselectdialog.cpp
index ac5f3b291..57cc7ceb5 100644
--- a/src/gui/windows/charselectdialog.cpp
+++ b/src/gui/windows/charselectdialog.cpp
@@ -113,7 +113,7 @@ CharSelectDialog::CharSelectDialog(LoginData &data) :
placer(n, 0, mInfoButton);
n ++;
- for (int i = 0; i < static_cast<int>(mLoginData->characterSlots); i++)
+ for (int i = 0; i < CAST_S32(mLoginData->characterSlots); i++)
{
CharacterDisplay *const character = new CharacterDisplay(this, this);
character->setVisible(Visible_false);
@@ -183,7 +183,7 @@ void CharSelectDialog::action(const ActionEvent &event)
// Check if a button of a character was pressed
const Widget *const sourceParent = event.getSource()->getParent();
int selected = -1;
- for (unsigned int i = 0, sz = static_cast<unsigned int>(
+ for (unsigned int i = 0, sz = CAST_U32(
mCharacterEntries.size()); i < sz; ++i)
{
if (mCharacterEntries[i] == sourceParent)
@@ -241,17 +241,17 @@ void CharSelectDialog::action(const ActionEvent &event)
// TRANSLATORS: char select dialog. player info message.
_("Hp: %u/%u\nMp: %u/%u\nLevel: %u\n"
"Experience: %u\nMoney: %s"),
- static_cast<uint32_t>(
+ CAST_U32(
character->data.mAttributes[Attributes::HP]),
- static_cast<uint32_t>(
+ CAST_U32(
character->data.mAttributes[Attributes::MAX_HP]),
- static_cast<uint32_t>(
+ CAST_U32(
character->data.mAttributes[Attributes::MP]),
- static_cast<uint32_t>(
+ CAST_U32(
character->data.mAttributes[Attributes::MAX_MP]),
- static_cast<uint32_t>(
+ CAST_U32(
character->data.mAttributes[Attributes::LEVEL]),
- static_cast<uint32_t>(
+ CAST_U32(
character->data.mAttributes[Attributes::EXP]),
Units::formatCurrency(
character->data.mAttributes[Attributes::MONEY]).c_str());
@@ -506,7 +506,7 @@ void CharSelectDialog::setCharacter(Net::Character *const character)
if (!character)
return;
const int characterSlot = character->slot;
- if (characterSlot >= static_cast<int>(mCharacterEntries.size()))
+ if (characterSlot >= CAST_S32(mCharacterEntries.size()))
{
logger->log("Warning: slot out of range: %d", character->slot);
return;
@@ -562,10 +562,10 @@ bool CharSelectDialog::selectByName(const std::string &name,
{
if (character->dummy && character->dummy->getName() == name)
{
- mCharacterView->show(static_cast<int>(i));
+ mCharacterView->show(CAST_S32(i));
updateState();
if (selAction == Choose)
- attemptCharacterSelect(static_cast<int>(i));
+ attemptCharacterSelect(CAST_S32(i));
return true;
}
}
@@ -616,7 +616,7 @@ void CharSelectDialog::updateState()
void CharSelectDialog::setName(const BeingId id, const std::string &newName)
{
- for (unsigned int i = 0, sz = static_cast<unsigned int>(
+ for (unsigned int i = 0, sz = CAST_U32(
mCharacterEntries.size()); i < sz; ++i)
{
if (!mCharacterEntries[i])
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp
index 8f74a6877..e15f68f35 100644
--- a/src/gui/windows/chatwindow.cpp
+++ b/src/gui/windows/chatwindow.cpp
@@ -403,7 +403,7 @@ void ChatWindow::closeTab() const
void ChatWindow::defaultTab()
{
if (mChatTabs)
- mChatTabs->setSelectedTabByIndex(static_cast<unsigned>(0));
+ mChatTabs->setSelectedTabByIndex(CAST_U32(0));
}
void ChatWindow::action(const ActionEvent &event)
@@ -773,7 +773,7 @@ void ChatWindow::keyPressed(KeyEvent &event)
if (mCurHist != mHistory.end())
{
mChatInput->setText(*mCurHist);
- mChatInput->setCaretPosition(static_cast<unsigned>(
+ mChatInput->setCaretPosition(CAST_U32(
mChatInput->getText().length()));
}
else
@@ -797,7 +797,7 @@ void ChatWindow::keyPressed(KeyEvent &event)
--mCurHist;
addCurrentToHistory();
mChatInput->setText(*mCurHist);
- mChatInput->setCaretPosition(static_cast<unsigned>(
+ mChatInput->setCaretPosition(CAST_U32(
mChatInput->getText().length()));
}
else if (actionId == InputAction::GUI_INSERT &&
@@ -828,7 +828,7 @@ void ChatWindow::keyPressed(KeyEvent &event)
{
if (!mChatHistoryIndex)
{
- mChatHistoryIndex = static_cast<unsigned>(
+ mChatHistoryIndex = CAST_U32(
tab->getRows().size());
mChatInput->setText("");
@@ -848,7 +848,7 @@ void ChatWindow::keyPressed(KeyEvent &event)
if (f == mChatHistoryIndex)
mChatInput->setText(*it);
}
- mChatInput->setCaretPosition(static_cast<unsigned>(
+ mChatInput->setCaretPosition(CAST_U32(
mChatInput->getText().length()));
}
}
@@ -860,11 +860,11 @@ void ChatWindow::keyPressed(KeyEvent &event)
{
const std::list<std::string> &rows = tab->getRows();
const size_t &tabSize = rows.size();
- if (static_cast<size_t>(mChatHistoryIndex) + 1 < tabSize)
+ if (CAST_SIZE(mChatHistoryIndex) + 1 < tabSize)
{
mChatHistoryIndex ++;
}
- else if (static_cast<size_t>(mChatHistoryIndex) < tabSize)
+ else if (CAST_SIZE(mChatHistoryIndex) < tabSize)
{
mChatHistoryIndex ++;
mChatInput->setText("");
@@ -884,7 +884,7 @@ void ChatWindow::keyPressed(KeyEvent &event)
if (f == mChatHistoryIndex)
mChatInput->setText(*it);
}
- mChatInput->setCaretPosition(static_cast<unsigned>(
+ mChatInput->setCaretPosition(CAST_U32(
mChatInput->getText().length()));
}
}
@@ -1014,8 +1014,8 @@ void ChatWindow::addInputText(const std::string &text, const bool space)
ss << inputText.substr(caretPos);
mChatInput->setText(ss.str());
- mChatInput->setCaretPosition(caretPos + static_cast<int>(
- text.length()) + static_cast<int>(space));
+ mChatInput->setCaretPosition(caretPos + CAST_S32(
+ text.length()) + CAST_S32(space));
requestChatFocus();
}
@@ -1298,7 +1298,7 @@ void ChatWindow::postConnection()
skip --; \
continue; \
} \
- const unsigned char ch = static_cast<unsigned char>(msg.at(f)); \
+ const unsigned char ch = CAST_U8(msg.at(f)); \
if (f + 2 < sz && msg.substr(f, 2) == "%%") \
{ \
newMsg += msg.at(f); \
@@ -1419,8 +1419,8 @@ void ChatWindow::autoComplete()
.append(inputText.substr(caretPos,
inputText.length() - caretPos)));
- const int len = caretPos - static_cast<int>(name.length())
- + static_cast<int>(newName.length());
+ const int len = caretPos - CAST_S32(name.length())
+ + CAST_S32(newName.length());
if (startName > 0)
mChatInput->setCaretPosition(len + 1);
@@ -1592,7 +1592,7 @@ bool ChatWindow::resortChatLog(std::string line,
{
const std::string nick = line.substr(0, idx2 - 1);
line = line.substr(idx2 + 6);
- localPetEmote(nick, static_cast<uint8_t>(
+ localPetEmote(nick, CAST_U8(
atoi(line.c_str())));
}
else if (line.find(": \302\202\302m") != std::string::npos)
@@ -1608,7 +1608,7 @@ bool ChatWindow::resortChatLog(std::string line,
{
const std::string nick = line.substr(0, idx2 - 1);
line = line.substr(idx2 + 6);
- localPetDirection(nick, static_cast<uint8_t>(
+ localPetDirection(nick, CAST_U8(
atoi(line.c_str())));
}
else if (line.find(": \302\202\302a") != std::string::npos)
@@ -1946,9 +1946,9 @@ bool ChatWindow::saveTab(const int num, ChatTab *const tab) const
tab->getChannelName());
serverConfig.setValue("chatWhisperFlags" + toString(num),
- static_cast<int>(tab->getAllowHighlight())
- + (2 * static_cast<int>(tab->getRemoveNames()))
- + (4 * static_cast<int>(tab->getNoAway())));
+ CAST_S32(tab->getAllowHighlight())
+ + (2 * CAST_S32(tab->getRemoveNames()))
+ + (4 * CAST_S32(tab->getNoAway())));
return true;
}
diff --git a/src/gui/windows/editserverdialog.cpp b/src/gui/windows/editserverdialog.cpp
index e456533cb..d45d46be3 100644
--- a/src/gui/windows/editserverdialog.cpp
+++ b/src/gui/windows/editserverdialog.cpp
@@ -230,7 +230,7 @@ void EditServerDialog::action(const ActionEvent &event)
mServer.description = mDescriptionField->getText();
mServer.onlineListUrl = mOnlineListUrlField->getText();
mServer.hostname = mServerAddressField->getText();
- mServer.port = static_cast<int16_t>(atoi(
+ mServer.port = CAST_S16(atoi(
mPortField->getText().c_str()));
mServer.persistentIp = mPersistentIp->isSelected();
diff --git a/src/gui/windows/emotewindow.cpp b/src/gui/windows/emotewindow.cpp
index fe2ab432b..7acbad13d 100644
--- a/src/gui/windows/emotewindow.cpp
+++ b/src/gui/windows/emotewindow.cpp
@@ -158,7 +158,7 @@ std::string EmoteWindow::getSelectedEmote() const
return std::string();
char chr[2];
- chr[0] = static_cast<char>('0' + index);
+ chr[0] = CAST_8('0' + index);
chr[1] = 0;
return std::string("%%").append(&chr[0]);
}
@@ -178,7 +178,7 @@ std::string EmoteWindow::getSelectedColor() const
return std::string();
char chr[2];
- chr[0] = static_cast<char>('0' + index);
+ chr[0] = CAST_8('0' + index);
chr[1] = 0;
return std::string("##").append(&chr[0]);
}
diff --git a/src/gui/windows/equipmentwindow.cpp b/src/gui/windows/equipmentwindow.cpp
index a32f80c3e..ddde610eb 100644
--- a/src/gui/windows/equipmentwindow.cpp
+++ b/src/gui/windows/equipmentwindow.cpp
@@ -713,7 +713,7 @@ void EquipmentWindow::loadSlot(const XmlNodePtr slotNode,
const int imageIndex = XML::getProperty(slotNode, "image", -1);
Image *image = nullptr;
- if (imageIndex >= 0 && imageIndex < static_cast<signed>(imageset->size()))
+ if (imageIndex >= 0 && imageIndex < CAST_S32(imageset->size()))
image = imageset->get(imageIndex);
std::vector<EquipmentBox*> &boxes = mPages[page]->boxes;
@@ -786,7 +786,7 @@ void EquipmentWindow::addBox(const int idx, int x, int y, const int imageIndex)
Image *image = nullptr;
if (mImageSet && imageIndex >= 0 && imageIndex
- < static_cast<signed>(mImageSet->size()))
+ < CAST_S32(mImageSet->size()))
{
image = mImageSet->get(imageIndex);
}
@@ -826,5 +826,5 @@ int EquipmentWindow::addPage(const std::string &name)
boxes.push_back(nullptr);
mTabs->addButton(name, name, false);
- return static_cast<int>(mPages.size()) - 1;
+ return CAST_S32(mPages.size()) - 1;
}
diff --git a/src/gui/windows/itemamountwindow.cpp b/src/gui/windows/itemamountwindow.cpp
index cefeaca7b..8ad79ecab 100644
--- a/src/gui/windows/itemamountwindow.cpp
+++ b/src/gui/windows/itemamountwindow.cpp
@@ -413,7 +413,7 @@ void ItemAmountWindow::action(const ActionEvent &event)
else if (eventId == "all")
amount = mMax;
else if (eventId == "slide")
- amount = static_cast<int>(mItemAmountSlide->getValue());
+ amount = CAST_S32(mItemAmountSlide->getValue());
mItemAmountTextField->setValue(amount);
mItemAmountSlide->setValue(amount);
@@ -429,22 +429,22 @@ void ItemAmountWindow::action(const ActionEvent &event)
if (eventId == "incPrice")
{
mPrice++;
- price = static_cast<int>(pow(10.0, mPrice));
+ price = CAST_S32(pow(10.0, mPrice));
mItemPriceTextField->setValue(price);
mItemPriceSlide->setValue(price);
}
else if (eventId == "decPrice")
{
mPrice--;
- price = static_cast<int>(pow(10.0, mPrice));
+ price = CAST_S32(pow(10.0, mPrice));
mItemPriceTextField->setValue(price);
mItemPriceSlide->setValue(price);
}
else if (eventId == "slidePrice")
{
- price = static_cast<int>(mItemPriceSlide->getValue());
+ price = CAST_S32(mItemPriceSlide->getValue());
if (price)
- mPrice = static_cast<int>(log(static_cast<float>(price)));
+ mPrice = CAST_S32(log(static_cast<float>(price)));
else
mPrice = 0;
mItemPriceTextField->setValue(price);
diff --git a/src/gui/windows/logindialog.cpp b/src/gui/windows/logindialog.cpp
index 3a0fd56ef..c39486dda 100644
--- a/src/gui/windows/logindialog.cpp
+++ b/src/gui/windows/logindialog.cpp
@@ -130,7 +130,7 @@ LoginDialog::LoginDialog(LoginData &data,
mUpdateTypeDropDown->setActionEventId("updatetype");
mUpdateTypeDropDown->setSelected((mLoginData->updateType
- | UpdateType::Custom) ^ static_cast<int>(UpdateType::Custom));
+ | UpdateType::Custom) ^ CAST_S32(UpdateType::Custom));
if (!mCustomUpdateHost->isSelected())
mUpdateHostText->setVisible(Visible_false);
@@ -339,7 +339,7 @@ void LoginDialog::prepareUpdate()
}
mLoginData->updateType = updateType;
- serverConfig.setValue("updateType", static_cast<int>(updateType));
+ serverConfig.setValue("updateType", CAST_S32(updateType));
mRegisterButton->setEnabled(false);
mServerButton->setEnabled(false);
diff --git a/src/gui/windows/mailwindow.cpp b/src/gui/windows/mailwindow.cpp
index 2d52a2e99..071a1ecee 100644
--- a/src/gui/windows/mailwindow.cpp
+++ b/src/gui/windows/mailwindow.cpp
@@ -252,7 +252,7 @@ void MailWindow::viewPrev(const int id)
if (it == mMessages.begin())
{
it = mMessages.end();
- mListBox->setSelected(static_cast<int>(mMessages.size()) - 1);
+ mListBox->setSelected(CAST_S32(mMessages.size()) - 1);
}
else
{
diff --git a/src/gui/windows/minimap.cpp b/src/gui/windows/minimap.cpp
index ae93c9190..797427c50 100644
--- a/src/gui/windows/minimap.cpp
+++ b/src/gui/windows/minimap.cpp
@@ -375,9 +375,9 @@ void Minimap::draw2(Graphics *const graphics)
if (userPalette)
graphics->setColor(userPalette->getColor(type));
- const int offsetHeight = static_cast<int>(static_cast<float>(
+ const int offsetHeight = CAST_S32(static_cast<float>(
dotSize - 1) * mHeightProportion);
- const int offsetWidth = static_cast<int>(static_cast<float>(
+ const int offsetWidth = CAST_S32(static_cast<float>(
dotSize - 1) * mWidthProportion);
const Vector &pos = being->getPosition();
@@ -414,15 +414,15 @@ void Minimap::draw2(Graphics *const graphics)
UserColorId::PARTY));
}
- const int offsetHeight = static_cast<int>(
+ const int offsetHeight = CAST_S32(
mHeightProportion);
- const int offsetWidth = static_cast<int>(
+ const int offsetWidth = CAST_S32(
mWidthProportion);
graphics->fillRectangle(Rect(
- static_cast<int>(member->getX()
+ CAST_S32(member->getX()
* mWidthProportion) + mMapOriginX - offsetWidth,
- static_cast<int>(member->getY()
+ CAST_S32(member->getY()
* mHeightProportion) + mMapOriginY - offsetHeight,
2, 2));
}
@@ -443,9 +443,9 @@ void Minimap::draw2(Graphics *const graphics)
+ viewport->getCameraRelativeY())
* mHeightProportion) / 32 + mMapOriginY;
- const int w = static_cast<int>(static_cast<float>(
+ const int w = CAST_S32(static_cast<float>(
gw) * mWidthProportion / 32);
- const int h = static_cast<int>(static_cast<float>(
+ const int h = CAST_S32(static_cast<float>(
gh) * mHeightProportion / 32);
if (w <= a.width)
diff --git a/src/gui/windows/ministatuswindow.cpp b/src/gui/windows/ministatuswindow.cpp
index 3ca9b8e35..1e43ce3b5 100644
--- a/src/gui/windows/ministatuswindow.cpp
+++ b/src/gui/windows/ministatuswindow.cpp
@@ -226,7 +226,7 @@ void MiniStatusWindow::updateBars()
void MiniStatusWindow::setIcon(const int index, AnimatedSprite *const sprite)
{
- if (index >= static_cast<int>(mIcons.size()))
+ if (index >= CAST_S32(mIcons.size()))
mIcons.resize(index + 1, nullptr);
delete mIcons[index];
@@ -235,7 +235,7 @@ void MiniStatusWindow::setIcon(const int index, AnimatedSprite *const sprite)
void MiniStatusWindow::eraseIcon(const int index)
{
- if (index < static_cast<int>(mIcons.size()))
+ if (index < CAST_S32(mIcons.size()))
{
delete mIcons[index];
mIcons.erase(mIcons.begin() + index);
diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp
index dc991097b..27386af5b 100644
--- a/src/gui/windows/npcdialog.cpp
+++ b/src/gui/windows/npcdialog.cpp
@@ -348,14 +348,14 @@ void NpcDialog::action(const ActionEvent &event)
gui->resetClickCount();
const int selectedIndex = mItemList->getSelected();
- if (selectedIndex >= static_cast<int>(mItems.size())
+ if (selectedIndex >= CAST_S32(mItems.size())
|| selectedIndex < 0
|| !PacketLimiter::limitPackets(
PacketType::PACKET_NPC_INPUT))
{
return;
}
- unsigned char choice = static_cast<unsigned char>(
+ unsigned char choice = CAST_U8(
selectedIndex + 1);
printText = mItems[selectedIndex];
@@ -678,7 +678,7 @@ void NpcDialog::closeDialog()
int NpcDialog::getNumberOfElements()
{
- return static_cast<int>(mItems.size());
+ return CAST_S32(mItems.size());
}
std::string NpcDialog::getElementAt(int i)
@@ -1118,7 +1118,7 @@ void NpcDialog::saveCamera()
if (!viewport || mCameraMode >= 0)
return;
- mCameraMode = static_cast<int>(settings.cameraMode);
+ mCameraMode = CAST_S32(settings.cameraMode);
mCameraX = viewport->getCameraRelativeX();
mCameraY = viewport->getCameraRelativeY();
}
@@ -1128,7 +1128,7 @@ void NpcDialog::restoreCamera()
if (!viewport || mCameraMode == -1)
return;
- if (static_cast<int>(settings.cameraMode) != mCameraMode)
+ if (CAST_S32(settings.cameraMode) != mCameraMode)
viewport->toggleCameraMode();
if (mCameraMode)
{
@@ -1206,7 +1206,7 @@ void NpcDialog::logic()
if (mShowAvatar && mAvatarBeing)
{
mAvatarBeing->logic();
- if (mPlayerBox->getWidth() < static_cast<signed>(3 * getPadding()))
+ if (mPlayerBox->getWidth() < CAST_S32(3 * getPadding()))
{
const Sprite *const sprite = mAvatarBeing->getSprite(0);
if (sprite)
diff --git a/src/gui/windows/outfitwindow.cpp b/src/gui/windows/outfitwindow.cpp
index 73cc5101d..83874f4c3 100644
--- a/src/gui/windows/outfitwindow.cpp
+++ b/src/gui/windows/outfitwindow.cpp
@@ -169,7 +169,7 @@ void OutfitWindow::load(const bool oldConfig)
std::vector<unsigned char> tokens2;
while (ss2 >> buf)
- tokens2.push_back(static_cast<unsigned char>(atoi(buf.c_str())));
+ tokens2.push_back(CAST_U8(atoi(buf.c_str())));
for (size_t i = 0, sz = tokens2.size();
i < sz && i < OUTFIT_ITEM_COUNT; i++)
@@ -181,8 +181,8 @@ void OutfitWindow::load(const bool oldConfig)
true);
}
mAwayOutfit = cfg->getValue("OutfitAwayIndex", OUTFITS_COUNT - 1);
- if (mAwayOutfit >= static_cast<int>(OUTFITS_COUNT))
- mAwayOutfit = static_cast<int>(OUTFITS_COUNT) - 1;
+ if (mAwayOutfit >= CAST_S32(OUTFITS_COUNT))
+ mAwayOutfit = CAST_S32(OUTFITS_COUNT) - 1;
if (mAwayOutfitCheck)
mAwayOutfitCheck->setSelected(mAwayOutfit == mCurrentOutfit);
@@ -204,7 +204,7 @@ void OutfitWindow::save() const
outfitStr.append(toString(res));
if (i < OUTFIT_ITEM_COUNT - 1)
outfitStr.append(" ");
- outfitColorsStr.append(toString(static_cast<int>(
+ outfitColorsStr.append(toString(CAST_S32(
toInt(mItemColors[o][i], int))));
if (i < OUTFIT_ITEM_COUNT - 1)
outfitColorsStr.append(" ");
@@ -249,7 +249,7 @@ void OutfitWindow::action(const ActionEvent &event)
}
else if (eventId == "unequip")
{
- if (mCurrentOutfit >= 0 && mCurrentOutfit < static_cast<int>(
+ if (mCurrentOutfit >= 0 && mCurrentOutfit < CAST_S32(
OUTFITS_COUNT))
{
mItemsUnequip[mCurrentOutfit] = mUnequipCheck->isSelected();
@@ -274,7 +274,7 @@ void OutfitWindow::wearOutfit(const int outfit, const bool unwearEmpty,
{
bool isEmpty = true;
- if (outfit < 0 || outfit > static_cast<int>(OUTFITS_COUNT))
+ if (outfit < 0 || outfit > CAST_S32(OUTFITS_COUNT))
return;
for (unsigned i = 0; i < OUTFIT_ITEM_COUNT; i++)
@@ -294,7 +294,7 @@ void OutfitWindow::wearOutfit(const int outfit, const bool unwearEmpty,
}
}
- if ((!isEmpty || unwearEmpty) && outfit < static_cast<int>(OUTFITS_COUNT)
+ if ((!isEmpty || unwearEmpty) && outfit < CAST_S32(OUTFITS_COUNT)
&& mItemsUnequip[outfit])
{
unequipNotInOutfit(outfit);
@@ -313,8 +313,8 @@ void OutfitWindow::copyOutfit(const int outfit)
void OutfitWindow::copyOutfit(const int src, const int dst)
{
- if (src < 0 || src > static_cast<int>(OUTFITS_COUNT)
- || dst < 0 || dst > static_cast<int>(OUTFITS_COUNT))
+ if (src < 0 || src > CAST_S32(OUTFITS_COUNT)
+ || dst < 0 || dst > CAST_S32(OUTFITS_COUNT))
{
return;
}
@@ -339,7 +339,7 @@ void OutfitWindow::draw(Graphics *graphics)
{
const int itemX = mPadding + ((i % mGridWidth) * mBoxWidth);
const int itemY = mPadding + mTitleBarHeight
- + ((i / static_cast<unsigned int>(mGridWidth)) * mBoxHeight);
+ + ((i / CAST_U32(mGridWidth)) * mBoxHeight);
graphics->setColor(mBorderColor);
graphics->drawRectangle(Rect(itemX, itemY, 32, 32));
@@ -395,7 +395,7 @@ void OutfitWindow::safeDraw(Graphics *graphics)
{
const int itemX = mPadding + ((i % mGridWidth) * mBoxWidth);
const int itemY = mPadding + mTitleBarHeight
- + ((i / static_cast<unsigned int>(mGridWidth)) * mBoxHeight);
+ + ((i / CAST_U32(mGridWidth)) * mBoxHeight);
graphics->setColor(mBorderColor);
graphics->drawRectangle(Rect(itemX, itemY, 32, 32));
@@ -558,7 +558,7 @@ int OutfitWindow::getIndexFromGrid(const int pointX, const int pointY) const
return -1;
const int index = (((pointY - mTitleBarHeight) / mBoxHeight) * mGridWidth)
+ (pointX - mPadding) / mBoxWidth;
- if (index >= static_cast<int>(OUTFIT_ITEM_COUNT) || index < 0)
+ if (index >= CAST_S32(OUTFIT_ITEM_COUNT) || index < 0)
return -1;
return index;
}
@@ -601,7 +601,7 @@ std::string OutfitWindow::keyName(const int number)
void OutfitWindow::next()
{
- if (mCurrentOutfit < (static_cast<int>(OUTFITS_COUNT) - 1))
+ if (mCurrentOutfit < (CAST_S32(OUTFITS_COUNT) - 1))
mCurrentOutfit++;
else
mCurrentOutfit = 0;
@@ -621,7 +621,7 @@ void OutfitWindow::showCurrentOutfit()
{
// TRANSLATORS: outfits window label
mCurrentLabel->setCaption(strprintf(_("Outfit: %d"), mCurrentOutfit + 1));
- if (mCurrentOutfit < static_cast<int>(OUTFITS_COUNT))
+ if (mCurrentOutfit < CAST_S32(OUTFITS_COUNT))
mUnequipCheck->setSelected(mItemsUnequip[mCurrentOutfit]);
else
mUnequipCheck->setSelected(false);
@@ -635,7 +635,7 @@ void OutfitWindow::wearNextOutfit(const bool all)
{
next();
if (!all && mCurrentOutfit >= 0 && mCurrentOutfit
- < static_cast<int>(OUTFITS_COUNT))
+ < CAST_S32(OUTFITS_COUNT))
{
bool fromStart = false;
while (!mItemsUnequip[mCurrentOutfit])
@@ -657,7 +657,7 @@ void OutfitWindow::wearPreviousOutfit(const bool all)
{
previous();
if (!all && mCurrentOutfit >= 0 && mCurrentOutfit
- < static_cast<int>(OUTFITS_COUNT))
+ < CAST_S32(OUTFITS_COUNT))
{
bool fromStart = false;
while (!mItemsUnequip[mCurrentOutfit])
@@ -694,7 +694,7 @@ void OutfitWindow::copyFromEquiped(const int dst)
{
mItems[dst][outfitCell] = item->getId();
mItemColors[dst][outfitCell++] = item->getColor();
- if (outfitCell >= static_cast<int>(OUTFIT_ITEM_COUNT))
+ if (outfitCell >= CAST_S32(OUTFIT_ITEM_COUNT))
break;
}
}
diff --git a/src/gui/windows/questswindow.cpp b/src/gui/windows/questswindow.cpp
index 3bea8577f..9e46c1793 100644
--- a/src/gui/windows/questswindow.cpp
+++ b/src/gui/windows/questswindow.cpp
@@ -369,10 +369,10 @@ void QuestsWindow::rebuild(const bool playSound)
FOR_EACH (std::vector<QuestItem*>::const_iterator, it, hidden)
(*it)->completeFlag = -1;
- if (updatedQuest == -1 || updatedQuest >= static_cast<int>(
+ if (updatedQuest == -1 || updatedQuest >= CAST_S32(
mQuestLinks.size()))
{
- updatedQuest = static_cast<int>(mQuestLinks.size() - 1);
+ updatedQuest = CAST_S32(mQuestLinks.size() - 1);
}
if (updatedQuest >= 0)
{
diff --git a/src/gui/windows/quitdialog.cpp b/src/gui/windows/quitdialog.cpp
index 1ef878aae..ff12795d4 100644
--- a/src/gui/windows/quitdialog.cpp
+++ b/src/gui/windows/quitdialog.cpp
@@ -141,7 +141,7 @@ QuitDialog::~QuitDialog()
void QuitDialog::placeOption(ContainerPlacer &placer,
RadioButton *const option)
{
- placer(0, static_cast<int>(mOptions.size()), option, 3);
+ placer(0, CAST_S32(mOptions.size()), option, 3);
mOptions.push_back(option);
}
diff --git a/src/gui/windows/registerdialog.cpp b/src/gui/windows/registerdialog.cpp
index 601f16aa8..3c4fe5ed2 100644
--- a/src/gui/windows/registerdialog.cpp
+++ b/src/gui/windows/registerdialog.cpp
@@ -149,7 +149,7 @@ void RegisterDialog::postInit()
Window::postInit();
setVisible(Visible_true);
mUserField->requestFocus();
- mUserField->setCaretPosition(static_cast<unsigned>(
+ mUserField->setCaretPosition(CAST_U32(
mUserField->getText().length()));
mRegisterButton->setEnabled(canSubmit());
diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp
index 1049085b4..f4cd045c3 100644
--- a/src/gui/windows/serverdialog.cpp
+++ b/src/gui/windows/serverdialog.cpp
@@ -521,7 +521,7 @@ void ServerDialog::loadServers(const bool addNew)
server.hostname = XML::getProperty(subNode, "hostname", "");
server.althostname = XML::getProperty(
subNode, "althostname", "");
- server.port = static_cast<uint16_t>(
+ server.port = CAST_U16(
XML::getProperty(subNode, "port", 0));
if (server.port == 0)
@@ -570,7 +570,7 @@ void ServerDialog::loadServers(const bool addNew)
MutexLocker tempLock(&mMutex);
// Add the server to the local list if it's not already present
bool found = false;
- for (unsigned int i = 0, sz = static_cast<unsigned int>(
+ for (unsigned int i = 0, sz = CAST_U32(
mServers.size()); i < sz; i++)
{
if (mServers[i] == server)
@@ -622,7 +622,7 @@ void ServerDialog::loadCustomServers()
persistentIpKey, 0) ? true : false;
const int defaultPort = defaultPortForServerType(server.type);
- server.port = static_cast<uint16_t>(
+ server.port = CAST_U16(
config.getValue(portKey, defaultPort));
// skip invalid server
@@ -640,7 +640,7 @@ void ServerDialog::saveCustomServers(const ServerInfo &currentServer,
// Make sure the current server is mentioned first
if (currentServer.isValid())
{
- if (index >= 0 && static_cast<size_t>(index) < mServers.size())
+ if (index >= 0 && CAST_SIZE(index) < mServers.size())
{
mServers[index] = currentServer;
}
@@ -660,7 +660,7 @@ void ServerDialog::saveCustomServers(const ServerInfo &currentServer,
int savedServerCount = 0;
- for (unsigned i = 0, sz = static_cast<unsigned>(mServers.size());
+ for (unsigned i = 0, sz = CAST_U32(mServers.size());
i < sz && savedServerCount < MAX_SERVERLIST; ++ i)
{
const ServerInfo &server = mServers.at(i);
@@ -712,7 +712,7 @@ int ServerDialog::downloadUpdate(void *ptr,
{
finished = true;
}
- else if (static_cast<int>(status) < 0)
+ else if (CAST_S32(status) < 0)
{
logger->log("Error retreiving server list: %s\n",
sd->mDownload->getError());
diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp
index b80f6d5fe..d8ae3ef2d 100644
--- a/src/gui/windows/skilldialog.cpp
+++ b/src/gui/windows/skilldialog.cpp
@@ -135,7 +135,7 @@ void SkillDialog::action(const ActionEvent &event)
if (tab)
{
if (const SkillInfo *const info = tab->getSelectedInfo())
- playerHandler->increaseSkill(static_cast<uint16_t>(info->id));
+ playerHandler->increaseSkill(CAST_U16(info->id));
}
}
else if (eventId == "sel")
@@ -150,7 +150,7 @@ void SkillDialog::action(const ActionEvent &event)
mUseButton->setCaption(info->useButton);
mIncreaseButton->setEnabled(info->id < SKILL_VAR_MIN_ID);
const int num = itemShortcutWindow->getTabIndex();
- if (num >= 0 && num < static_cast<int>(SHORTCUT_TABS)
+ if (num >= 0 && num < CAST_S32(SHORTCUT_TABS)
&& itemShortcut[num])
{
itemShortcut[num]->setItemSelected(
@@ -329,7 +329,7 @@ void SkillDialog::loadXmlFile(const std::string &fileName)
if (!skill)
{
skill = new SkillInfo;
- skill->id = static_cast<unsigned int>(id);
+ skill->id = CAST_U32(id);
skill->modifiable = Modifiable_false;
skill->model = model;
skill->update();
@@ -482,7 +482,7 @@ void SkillDialog::addSkill(const SkillOwner::Type owner,
if (mDefaultModel)
{
SkillInfo *const skill = new SkillInfo;
- skill->id = static_cast<unsigned int>(id);
+ skill->id = CAST_U32(id);
skill->type = type;
skill->owner = owner;
SkillData *const data = skill->data;
diff --git a/src/gui/windows/textcommandeditor.cpp b/src/gui/windows/textcommandeditor.cpp
index 799456fe0..c2a5d66c9 100644
--- a/src/gui/windows/textcommandeditor.cpp
+++ b/src/gui/windows/textcommandeditor.cpp
@@ -151,11 +151,11 @@ TextCommandEditor::TextCommandEditor(TextCommand *const command) :
mSymbolTextField->setText(command->getSymbol());
mCommandTextField->setText(command->getCommand());
mCommentTextField->setText(command->getComment());
- mTypeDropDown->setSelected(static_cast<int>(command->getTargetType()));
+ mTypeDropDown->setSelected(CAST_S32(command->getTargetType()));
#ifdef TMWA_SUPPORT
mManaField->setValue(command->getMana());
mMagicLvlField->setValue(command->getBaseLvl());
- mSchoolDropDown->setSelected(static_cast<int>(command->getSchool())
+ mSchoolDropDown->setSelected(CAST_S32(command->getSchool())
- MAGIC_START_ID);
mSchoolLvlField->setValue(command->getSchoolLvl());
#endif
diff --git a/src/gui/windows/textdialog.cpp b/src/gui/windows/textdialog.cpp
index e777cf6a8..442cd5c67 100644
--- a/src/gui/windows/textdialog.cpp
+++ b/src/gui/windows/textdialog.cpp
@@ -71,7 +71,7 @@ TextDialog::TextDialog(const std::string &restrict title,
int width = getFont()->getWidth(title);
if (width < textLabel->getWidth())
width = textLabel->getWidth();
- reflowLayout(static_cast<int>(width + 20));
+ reflowLayout(CAST_S32(width + 20));
}
void TextDialog::postInit()
diff --git a/src/gui/windows/textselectdialog.cpp b/src/gui/windows/textselectdialog.cpp
index bac3ac0e4..dbc34bfaf 100644
--- a/src/gui/windows/textselectdialog.cpp
+++ b/src/gui/windows/textselectdialog.cpp
@@ -136,7 +136,7 @@ void TextSelectDialog::action(const ActionEvent &event)
else if (eventId == "select")
{
const int index = mItemList->getSelected();
- if (index < 0 || index >= static_cast<int>(mModel->size()))
+ if (index < 0 || index >= CAST_S32(mModel->size()))
return;
mText = mModel->getElementAt(index);
distributeActionEvent();
diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp
index bf4814a03..e6e97553a 100644
--- a/src/gui/windows/updaterwindow.cpp
+++ b/src/gui/windows/updaterwindow.cpp
@@ -531,7 +531,7 @@ int UpdaterWindow::updateProgress(void *ptr,
progress = 1.0F;
uw->setLabel(std::string(uw->mCurrentFile).append(" (")
- .append(toString(static_cast<int>(progress * 100))).append("%)"));
+ .append(toString(CAST_S32(progress * 100))).append("%)"));
uw->setProgress(progress);
@@ -554,11 +554,11 @@ size_t UpdaterWindow::memoryWrite(void *ptr, size_t size,
if (!uw)
return 0;
uw->mMemoryBuffer = static_cast<char*>(realloc(uw->mMemoryBuffer,
- static_cast<size_t>(uw->mDownloadedBytes) + totalMem));
+ CAST_SIZE(uw->mDownloadedBytes) + totalMem));
if (uw->mMemoryBuffer)
{
memcpy(&(uw->mMemoryBuffer[uw->mDownloadedBytes]), ptr, totalMem);
- uw->mDownloadedBytes += static_cast<int>(totalMem);
+ uw->mDownloadedBytes += CAST_S32(totalMem);
}
return totalMem;
@@ -655,7 +655,7 @@ void UpdaterWindow::loadUpdates()
}
std::string fixPath = mUpdatesDir + "/fix";
- const unsigned sz = static_cast<unsigned>(mUpdateFiles.size());
+ const unsigned sz = CAST_U32(mUpdateFiles.size());
for (mUpdateIndex = 0; mUpdateIndex < sz; mUpdateIndex++)
{
const UpdateFile &file = mUpdateFiles[mUpdateIndex];
@@ -685,7 +685,7 @@ void UpdaterWindow::loadLocalUpdates(const std::string &dir)
}
const std::string fixPath = dir + "/fix";
- for (unsigned int updateIndex = 0, sz = static_cast<unsigned int>(
+ for (unsigned int updateIndex = 0, sz = CAST_U32(
updateFiles.size()); updateIndex < sz; updateIndex ++)
{
const UpdateFile &file = updateFiles[updateIndex];
@@ -712,7 +712,7 @@ void UpdaterWindow::unloadUpdates(const std::string &dir)
}
const std::string fixPath = dir + "/fix";
- for (unsigned int updateIndex = 0, sz = static_cast<unsigned int>(
+ for (unsigned int updateIndex = 0, sz = CAST_U32(
updateFiles.size()); updateIndex < sz; updateIndex ++)
{
UpdaterWindow::removeUpdateFile(dir,
@@ -728,7 +728,7 @@ void UpdaterWindow::loadManaPlusUpdates(const std::string &dir)
std::vector<UpdateFile> updateFiles = loadXMLFile(
std::string(fixPath).append("/").append(xmlUpdateFile), false);
- for (unsigned int updateIndex = 0, sz = static_cast<unsigned int>(
+ for (unsigned int updateIndex = 0, sz = CAST_U32(
updateFiles.size()); updateIndex < sz; updateIndex ++)
{
const UpdateFile &file = updateFiles[updateIndex];
@@ -752,7 +752,7 @@ void UpdaterWindow::unloadManaPlusUpdates(const std::string &dir)
const std::vector<UpdateFile> updateFiles = loadXMLFile(
std::string(fixPath).append("/").append(xmlUpdateFile), true);
- for (unsigned int updateIndex = 0, sz = static_cast<unsigned int>(
+ for (unsigned int updateIndex = 0, sz = CAST_U32(
updateFiles.size()); updateIndex < sz; updateIndex ++)
{
std::string name = updateFiles[updateIndex].name;
@@ -815,11 +815,11 @@ void UpdaterWindow::logic()
mProgressBar->setProgress(mDownloadProgress);
if (mUpdateFiles.size()
- && static_cast<size_t>(mUpdateIndex) <= mUpdateFiles.size())
+ && CAST_SIZE(mUpdateIndex) <= mUpdateFiles.size())
{
mProgressBar->setText(strprintf("%u/%u", mUpdateIndex
- + mUpdateIndexOffset + 1, static_cast<unsigned>(
- mUpdateFiles.size()) + static_cast<int>(
+ + mUpdateIndexOffset + 1, CAST_U32(
+ mUpdateFiles.size()) + CAST_S32(
mTempUpdateFiles.size()) + 1));
}
else
@@ -911,7 +911,7 @@ void UpdaterWindow::logic()
case UPDATE_RESOURCES:
if (mDownloadComplete)
{
- if (static_cast<size_t>(mUpdateIndex) < mUpdateFiles.size())
+ if (CAST_SIZE(mUpdateIndex) < mUpdateFiles.size())
{
UpdateFile thisFile = mUpdateFiles[mUpdateIndex];
if (thisFile.type == "music"
@@ -983,7 +983,7 @@ void UpdaterWindow::logic()
if (mDownloadComplete)
{
mValidateXml = false;
- if (static_cast<size_t>(mUpdateIndex)
+ if (CAST_SIZE(mUpdateIndex)
< mTempUpdateFiles.size())
{
const UpdateFile thisFile = mTempUpdateFiles[mUpdateIndex];
@@ -1027,7 +1027,7 @@ void UpdaterWindow::logic()
break;
default:
logger->log("UpdaterWindow::logic unknown status: "
- + toString(static_cast<unsigned>(mDownloadStatus)));
+ + toString(CAST_U32(mDownloadStatus)));
break;
}
BLOCK_END("UpdaterWindow::logic")
@@ -1085,7 +1085,7 @@ void UpdaterWindow::loadMods(const std::string &dir,
splitToStringSet(modsList, modsString, '|');
const std::string fixPath = dir + "/fix";
- for (unsigned int updateIndex = 0, sz = static_cast<unsigned int>(
+ for (unsigned int updateIndex = 0, sz = CAST_U32(
updateFiles.size()); updateIndex < sz; updateIndex ++)
{
const UpdateFile &file = updateFiles[updateIndex];
@@ -1105,7 +1105,7 @@ void UpdaterWindow::loadMods(const std::string &dir,
std::vector<UpdateFile> updateFiles2 = loadXMLFile(
std::string(fixPath).append("/").append(xmlUpdateFile), true);
- for (unsigned int updateIndex = 0, sz = static_cast<unsigned int>(
+ for (unsigned int updateIndex = 0, sz = CAST_U32(
updateFiles2.size()); updateIndex < sz; updateIndex ++)
{
const UpdateFile &file = updateFiles2[updateIndex];
diff --git a/src/gui/windows/whoisonline.cpp b/src/gui/windows/whoisonline.cpp
index d51af6b05..e5a803a29 100644
--- a/src/gui/windows/whoisonline.cpp
+++ b/src/gui/windows/whoisonline.cpp
@@ -459,7 +459,7 @@ void WhoIsOnline::loadWebList()
level = 0;
OnlinePlayer *const player = new OnlinePlayer(nick,
- static_cast<unsigned char>(255), level,
+ CAST_U8(255), level,
Gender::UNSPECIFIED, -1);
mOnlinePlayers.insert(player);
mOnlineNicks.insert(nick);
@@ -502,11 +502,11 @@ size_t WhoIsOnline::memoryWrite(void *restrict ptr,
reinterpret_cast<WhoIsOnline *restrict>(stream);
const size_t totalMem = size * nmemb;
wio->mMemoryBuffer = static_cast<char*>(realloc(wio->mMemoryBuffer,
- static_cast<size_t>(wio->mDownloadedBytes) + totalMem));
+ CAST_SIZE(wio->mDownloadedBytes) + totalMem));
if (wio->mMemoryBuffer)
{
memcpy(&(wio->mMemoryBuffer[wio->mDownloadedBytes]), ptr, totalMem);
- wio->mDownloadedBytes += static_cast<int>(totalMem);
+ wio->mDownloadedBytes += CAST_S32(totalMem);
}
return totalMem;
@@ -570,7 +570,7 @@ int WhoIsOnline::downloadThread(void *ptr)
case CURLE_COULDNT_CONNECT:
default:
std::cerr << "curl error "
- << static_cast<unsigned>(res) << ": "
+ << CAST_U32(res) << ": "
<< wio->mCurlError << " host: "
<< url.c_str() << std::endl;
break;