diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/beingpopup.cpp | 2 | ||||
-rw-r--r-- | src/gui/changeemaildialog.cpp | 4 | ||||
-rw-r--r-- | src/gui/changepassworddialog.cpp | 4 | ||||
-rw-r--r-- | src/gui/charcreatedialog.cpp | 7 | ||||
-rw-r--r-- | src/gui/chatwindow.cpp | 3 | ||||
-rw-r--r-- | src/gui/ministatuswindow.cpp | 20 | ||||
-rw-r--r-- | src/gui/outfitwindow.cpp | 8 | ||||
-rw-r--r-- | src/gui/outfitwindow.h | 2 | ||||
-rw-r--r-- | src/gui/popupmenu.cpp | 7 | ||||
-rw-r--r-- | src/gui/registerdialog.cpp | 8 | ||||
-rw-r--r-- | src/gui/skilldialog.cpp | 9 | ||||
-rw-r--r-- | src/gui/statuswindow.cpp | 37 | ||||
-rw-r--r-- | src/gui/unregisterdialog.cpp | 4 | ||||
-rw-r--r-- | src/gui/updaterwindow.cpp | 7 | ||||
-rw-r--r-- | src/gui/widgets/dropshortcutcontainer.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/itemshortcutcontainer.cpp | 7 | ||||
-rw-r--r-- | src/gui/widgets/setupitem.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/textfield.cpp | 2 |
18 files changed, 78 insertions, 59 deletions
diff --git a/src/gui/beingpopup.cpp b/src/gui/beingpopup.cpp index 879b50245..ad019e9a6 100644 --- a/src/gui/beingpopup.cpp +++ b/src/gui/beingpopup.cpp @@ -149,7 +149,7 @@ void BeingPopup::show(int x, int y, Being *b) if (b->getPvpRank() > 0) { - label3->setCaption(strprintf(_("Pvp rank: %d"), b->getPvpRank())); + label3->setCaption(strprintf(_("Pvp rank: %u"), b->getPvpRank())); label3->adjustSize(); } else diff --git a/src/gui/changeemaildialog.cpp b/src/gui/changeemaildialog.cpp index 125266b9a..47fc27a92 100644 --- a/src/gui/changeemaildialog.cpp +++ b/src/gui/changeemaildialog.cpp @@ -130,14 +130,14 @@ void ChangeEmailDialog::action(const gcn::ActionEvent &event) { // First email address too short errorMsg << strprintf(_("The new email address needs to be at " - "least %d characters long."), min); + "least %u characters long."), min); error = 1; } else if (newFirstEmail.length() > max - 1 ) { // First email address too long errorMsg << strprintf(_("The new email address needs to be " - "less than %d characters long."), max); + "less than %u characters long."), max); error = 1; } else if (newFirstEmail != newSecondEmail) diff --git a/src/gui/changepassworddialog.cpp b/src/gui/changepassworddialog.cpp index 5f233df77..657bf8fd9 100644 --- a/src/gui/changepassworddialog.cpp +++ b/src/gui/changepassworddialog.cpp @@ -118,14 +118,14 @@ void ChangePasswordDialog::action(const gcn::ActionEvent &event) { // First password too short errorMsg << strprintf(_("The new password needs to be at least" - " %d characters long."), min); + " %u characters long."), min); error = 2; } else if (newFirstPass.length() > max - 1 ) { // First password too long errorMsg << strprintf(_("The new password needs to be less " - "than %d characters long."), max); + "than %u characters long."), max); error = 2; } else if (newFirstPass != newSecondPass) diff --git a/src/gui/charcreatedialog.cpp b/src/gui/charcreatedialog.cpp index 5611efa4c..b71b812d2 100644 --- a/src/gui/charcreatedialog.cpp +++ b/src/gui/charcreatedialog.cpp @@ -63,7 +63,7 @@ const static Being::Action actions[] = Being::STAND, Being::SIT, Being::MOVE, Being::ATTACK, Being::DEAD }; -const static int directions[] = +const static uint8_t directions[] = { Being::DOWN, Being::RIGHT, Being::UP, Being::LEFT }; @@ -282,7 +282,8 @@ void CharCreateDialog::action(const gcn::ActionEvent &event) #endif Net::getCharHandler()->newCharacter(getName(), characterSlot, - mFemale->isSelected(), mHairStyle, mHairColor, mRace, atts); + mFemale->isSelected(), mHairStyle, mHairColor, + static_cast<uint16_t>(mRace), atts); } else { @@ -543,7 +544,7 @@ void CharCreateDialog::updateRace() mRace = -100 - id; } - mPlayer->setSubtype(mRace); + mPlayer->setSubtype(static_cast<uint16_t>(mRace)); const ItemInfo &item = ItemDB::get(id); mRaceNameLabel->setCaption(item.getName()); mRaceNameLabel->adjustSize(); diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp index 1ea40a207..fc30fbc04 100644 --- a/src/gui/chatwindow.cpp +++ b/src/gui/chatwindow.cpp @@ -961,7 +961,8 @@ void ChatWindow::processEvent(Channels channel, const DepricatedEvent &event) if (id == Net::getPlayerHandler()->getJobLocation()) { std::pair<int, int> exp - = PlayerInfo::getStatExperience(id); + = PlayerInfo::getStatExperience( + static_cast<PlayerInfo::Attribute>(id)); if (event.getInt("oldValue1") > exp.first || !event.getInt("oldValue2")) { diff --git a/src/gui/ministatuswindow.cpp b/src/gui/ministatuswindow.cpp index 54ededd41..cc374d386 100644 --- a/src/gui/ministatuswindow.cpp +++ b/src/gui/ministatuswindow.cpp @@ -297,17 +297,17 @@ void MiniStatusWindow::mouseMoved(gcn::MouseEvent &event) > PlayerInfo::getAttribute(PlayerInfo::EXP_NEEDED)) { mTextPopup->show(x + getX(), y + getY(), - event.getSource()->getId(), strprintf("%u/%u", + event.getSource()->getId(), strprintf("%d/%d", PlayerInfo::getAttribute(PlayerInfo::EXP), PlayerInfo::getAttribute(PlayerInfo::EXP_NEEDED))); } else { mTextPopup->show(x + getX(), y + getY(), - event.getSource()->getId(), strprintf("%u/%u", + event.getSource()->getId(), strprintf("%d/%d", PlayerInfo::getAttribute(PlayerInfo::EXP), PlayerInfo::getAttribute(PlayerInfo::EXP_NEEDED)), - strprintf("%s: %u", _("Need"), + strprintf("%s: %d", _("Need"), PlayerInfo::getAttribute(PlayerInfo::EXP_NEEDED) - PlayerInfo::getAttribute(PlayerInfo::EXP))); } @@ -316,14 +316,14 @@ void MiniStatusWindow::mouseMoved(gcn::MouseEvent &event) else if (event.getSource() == mHpBar) { mTextPopup->show(x + getX(), y + getY(), event.getSource()->getId(), - strprintf("%u/%u", PlayerInfo::getAttribute(PlayerInfo::HP), + strprintf("%d/%d", PlayerInfo::getAttribute(PlayerInfo::HP), PlayerInfo::getAttribute(PlayerInfo::MAX_HP))); mStatusPopup->hide(); } else if (event.getSource() == mMpBar) { mTextPopup->show(x + getX(), y + getY(), event.getSource()->getId(), - strprintf("%u/%u", PlayerInfo::getAttribute(PlayerInfo::MP), + strprintf("%d/%d", PlayerInfo::getAttribute(PlayerInfo::MP), PlayerInfo::getAttribute(PlayerInfo::MAX_MP))); mStatusPopup->hide(); } @@ -336,21 +336,21 @@ void MiniStatusWindow::mouseMoved(gcn::MouseEvent &event) { mTextPopup->show(x + getX(), y + getY(), event.getSource()->getId(), - strprintf("%u/%u", exp.first, exp.second)); + strprintf("%d/%d", exp.first, exp.second)); } else { mTextPopup->show(x + getX(), y + getY(), event.getSource()->getId(), - strprintf("%u/%u", exp.first, exp.second), - strprintf("%s: %u", _("Need"), exp.second - exp.first)); + strprintf("%d/%d", exp.first, exp.second), + strprintf("%s: %d", _("Need"), exp.second - exp.first)); } mStatusPopup->hide(); } else if (event.getSource() == mWeightBar) { mTextPopup->show(x + getX(), y + getY(), event.getSource()->getId(), - strprintf("%u/%u", PlayerInfo::getAttribute( + strprintf("%d/%d", PlayerInfo::getAttribute( PlayerInfo::TOTAL_WEIGHT), PlayerInfo::getAttribute(PlayerInfo::MAX_WEIGHT))); mStatusPopup->hide(); @@ -365,7 +365,7 @@ void MiniStatusWindow::mouseMoved(gcn::MouseEvent &event) mTextPopup->show(x + getX(), y + getY(), event.getSource()->getId(), - strprintf("%u/%u", usedSlots, maxSlots)); + strprintf("%d/%d", usedSlots, maxSlots)); } mStatusPopup->hide(); } diff --git a/src/gui/outfitwindow.cpp b/src/gui/outfitwindow.cpp index eaf511a17..277ef904a 100644 --- a/src/gui/outfitwindow.cpp +++ b/src/gui/outfitwindow.cpp @@ -142,10 +142,10 @@ void OutfitWindow::load(bool oldConfig) std::string buf; std::stringstream ss(outfit); - std::vector<int> tokens; + std::vector<unsigned char> tokens; while (ss >> buf) - tokens.push_back(atoi(buf.c_str())); + tokens.push_back(static_cast<unsigned char>(atoi(buf.c_str()))); for (int i = 0; i < static_cast<int>(tokens.size()) && i < OUTFIT_ITEM_COUNT; i++) @@ -160,7 +160,7 @@ void OutfitWindow::load(bool oldConfig) tokens.clear(); while (ss2 >> buf) - tokens.push_back(atoi(buf.c_str())); + tokens.push_back(static_cast<unsigned char>(atoi(buf.c_str()))); for (int i = 0; i < static_cast<int>(tokens.size()) && i < OUTFIT_ITEM_COUNT; i++) @@ -373,7 +373,7 @@ void OutfitWindow::mouseDragged(gcn::MouseEvent &event) return; } const int itemId = mItems[mCurrentOutfit][index]; - const int itemColor = mItemColors[mCurrentOutfit][index]; + const unsigned char itemColor = mItemColors[mCurrentOutfit][index]; if (itemId < 0) { Window::mouseDragged(event); diff --git a/src/gui/outfitwindow.h b/src/gui/outfitwindow.h index 6881bdbc6..2ce281b45 100644 --- a/src/gui/outfitwindow.h +++ b/src/gui/outfitwindow.h @@ -129,7 +129,7 @@ class OutfitWindow : public Window, gcn::ActionListener unsigned char mItemColors[OUTFITS_COUNT + 1][OUTFIT_ITEM_COUNT]; bool mItemsUnequip[OUTFITS_COUNT]; int mItemSelected; - int mItemColorSelected; + unsigned char mItemColorSelected; int mCurrentOutfit; int mAwayOutfit; diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index c8351914f..2df651ab1 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -276,14 +276,15 @@ void PopupMenu::showPopup(int x, int y, std::vector<ActorSprite*> &beings) if (being && !being->getName().empty()) { mBrowserBox->addRow(strprintf("@@player_%u|%s >@@", - being->getId(), (being->getName() + static_cast<unsigned>(being->getId()), (being->getName() + being->getGenderSignWithSpace()).c_str())); } else if (actor->getType() == ActorSprite::FLOOR_ITEM) { FloorItem *floorItem = static_cast<FloorItem*>(actor); mBrowserBox->addRow(strprintf("@@flooritem_%u|%s >@@", - actor->getId(), floorItem->getName().c_str())); + static_cast<unsigned>(actor->getId()), + floorItem->getName().c_str())); } } mBrowserBox->addRow("##3---"); @@ -648,7 +649,7 @@ void PopupMenu::showChangePos(int x, int y) for (PositionsMap::const_iterator itr = map.begin(), itr_end = map.end(); itr != itr_end; ++itr) { - mBrowserBox->addRow(strprintf("@@guild-pos-%d|%s@@", + mBrowserBox->addRow(strprintf("@@guild-pos-%u|%s@@", itr->first, itr->second.c_str())); } mBrowserBox->addRow("cancel", _("Cancel")); diff --git a/src/gui/registerdialog.cpp b/src/gui/registerdialog.cpp index 895d841b6..988d4c718 100644 --- a/src/gui/registerdialog.cpp +++ b/src/gui/registerdialog.cpp @@ -184,7 +184,7 @@ void RegisterDialog::action(const gcn::ActionEvent &event) { // Name too short errorMsg = strprintf - (_("The username needs to be at least %d characters long."), + (_("The username needs to be at least %u characters long."), minUser); error = 1; } @@ -192,7 +192,7 @@ void RegisterDialog::action(const gcn::ActionEvent &event) { // Name too long errorMsg = strprintf - (_("The username needs to be less than %d characters long."), + (_("The username needs to be less than %u characters long."), maxUser); error = 1; } @@ -200,7 +200,7 @@ void RegisterDialog::action(const gcn::ActionEvent &event) { // Pass too short errorMsg = strprintf - (_("The password needs to be at least %d characters long."), + (_("The password needs to be at least %u characters long."), minPass); error = 2; } @@ -208,7 +208,7 @@ void RegisterDialog::action(const gcn::ActionEvent &event) { // Pass too long errorMsg = strprintf - (_("The password needs to be less than %d characters long."), + (_("The password needs to be less than %u characters long."), maxPass); error = 2; } diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp index 47de3b381..aa8ea716f 100644 --- a/src/gui/skilldialog.cpp +++ b/src/gui/skilldialog.cpp @@ -561,10 +561,13 @@ void SkillInfo::setIcon(const std::string &iconPath) void SkillInfo::update() { - int baseLevel = PlayerInfo::getStatBase(id); - int effLevel = PlayerInfo::getStatEffective(id); + int baseLevel = PlayerInfo::getStatBase( + static_cast<PlayerInfo::Attribute>(id)); + int effLevel = PlayerInfo::getStatEffective( + static_cast<PlayerInfo::Attribute>(id)); - std::pair<int, int> exp = PlayerInfo::getStatExperience(id); + std::pair<int, int> exp = PlayerInfo::getStatExperience( + static_cast<PlayerInfo::Attribute>(id)); if (!modifiable && baseLevel == 0 && effLevel == 0 && exp.second == 0) { diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp index 267bd9cfc..73d95c54b 100644 --- a/src/gui/statuswindow.cpp +++ b/src/gui/statuswindow.cpp @@ -360,11 +360,12 @@ void StatusWindow::processEvent(Channels channel A_UNUSED, { if (mJobLvlLabel) { - int lvl = PlayerInfo::getStatBase(id); + int lvl = PlayerInfo::getStatBase( + static_cast<PlayerInfo::Attribute>(id)); int oldExp = event.getInt("oldValue1"); - std::pair<int, int> exp - = PlayerInfo::getStatExperience(id); + std::pair<int, int> exp = PlayerInfo::getStatExperience( + static_cast<PlayerInfo::Attribute>(id)); if (!lvl) { @@ -378,7 +379,8 @@ void StatusWindow::processEvent(Channels channel A_UNUSED, { lvl = (exp.second - 20000) / 150; blocked = true; - PlayerInfo::setStatBase(id, lvl); + PlayerInfo::setStatBase( + static_cast<PlayerInfo::Attribute>(id), lvl); blocked = false; } } @@ -389,8 +391,10 @@ void StatusWindow::processEvent(Channels channel A_UNUSED, lvl ++; blocked = true; PlayerInfo::setStatExperience( - id, exp.first, 20000 + lvl * 150); - PlayerInfo::setStatBase(id, lvl); + static_cast<PlayerInfo::Attribute>(id), + exp.first, 20000 + lvl * 150); + PlayerInfo::setStatBase( + static_cast<PlayerInfo::Attribute>(id), lvl); blocked = false; } @@ -573,7 +577,8 @@ void StatusWindow::updateJobBar(ProgressBar *bar, bool percent) void StatusWindow::updateProgressBar(ProgressBar *bar, int id, bool percent) { - std::pair<int, int> exp = PlayerInfo::getStatExperience(id); + std::pair<int, int> exp = PlayerInfo::getStatExperience( + static_cast<PlayerInfo::Attribute>(id)); updateProgressBar(bar, exp.first, exp.second, percent); } @@ -758,8 +763,10 @@ AttrDisplay::~AttrDisplay() std::string AttrDisplay::update() { - int base = PlayerInfo::getStatBase(mId); - int bonus = PlayerInfo::getStatMod(mId); + int base = PlayerInfo::getStatBase( + static_cast<PlayerInfo::Attribute>(mId)); + int bonus = PlayerInfo::getStatMod( + static_cast<PlayerInfo::Attribute>(mId)); std::string value = toString(base + bonus); if (bonus) value += strprintf("=%d%+d", base, bonus); @@ -845,8 +852,10 @@ void ChangeDisplay::action(const gcn::ActionEvent &event) PlayerInfo::CHAR_POINTS) + 1; PlayerInfo::setAttribute(PlayerInfo::CHAR_POINTS, newpoints); - int newbase = PlayerInfo::getStatBase(mId) - 1; - PlayerInfo::setStatBase(mId, newbase); + int newbase = PlayerInfo::getStatBase( + static_cast<PlayerInfo::Attribute>(mId)) - 1; + PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>( + mId), newbase); Net::getPlayerHandler()->decreaseAttribute(mId); } @@ -864,8 +873,10 @@ void ChangeDisplay::action(const gcn::ActionEvent &event) PlayerInfo::CHAR_POINTS) - cnt; PlayerInfo::setAttribute(PlayerInfo::CHAR_POINTS, newpoints); - int newbase = PlayerInfo::getStatBase(mId) + cnt; - PlayerInfo::setStatBase(mId, newbase); + int newbase = PlayerInfo::getStatBase( + static_cast<PlayerInfo::Attribute>(mId)) + cnt; + PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>( + mId), newbase); for (unsigned f = 0; f < mInc->getClickCount(); f ++) { diff --git a/src/gui/unregisterdialog.cpp b/src/gui/unregisterdialog.cpp index 6887ffbb8..e2aa24321 100644 --- a/src/gui/unregisterdialog.cpp +++ b/src/gui/unregisterdialog.cpp @@ -118,7 +118,7 @@ void UnRegisterDialog::action(const gcn::ActionEvent &event) if (password.length() < min) { // Pass too short - errorMsg << strprintf(_("The password needs to be at least %d " + errorMsg << strprintf(_("The password needs to be at least %u " "characters long."), min); error = true; } @@ -126,7 +126,7 @@ void UnRegisterDialog::action(const gcn::ActionEvent &event) { // Pass too long errorMsg << strprintf(_("The password needs to be less than " - "%d characters long."), max); + "%u characters long."), max); error = true; } diff --git a/src/gui/updaterwindow.cpp b/src/gui/updaterwindow.cpp index 43185b418..154594e60 100644 --- a/src/gui/updaterwindow.cpp +++ b/src/gui/updaterwindow.cpp @@ -615,9 +615,10 @@ void UpdaterWindow::logic() mProgressBar->setProgress(mDownloadProgress); if (mUpdateFiles.size() && mUpdateIndex <= mUpdateFiles.size()) { - mProgressBar->setText(strprintf("%d/%d", mUpdateIndex - + mUpdateIndexOffset + 1, static_cast<int>(mUpdateFiles.size()) - + static_cast<int>(mTempUpdateFiles.size()) + 1)); + mProgressBar->setText(strprintf("%u/%u", mUpdateIndex + + mUpdateIndexOffset + 1, static_cast<unsigned>( + mUpdateFiles.size()) + static_cast<int>( + mTempUpdateFiles.size()) + 1)); } else { diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp index d6d31871b..fca1af17f 100644 --- a/src/gui/widgets/dropshortcutcontainer.cpp +++ b/src/gui/widgets/dropshortcutcontainer.cpp @@ -185,7 +185,7 @@ void DropShortcutContainer::mouseDragged(gcn::MouseEvent &event) return; const int itemId = dropShortcut->getItem(index); - const int itemColor = dropShortcut->getItemColor(index); + const unsigned char itemColor = dropShortcut->getItemColor(index); if (itemId < 0) return; @@ -288,7 +288,7 @@ void DropShortcutContainer::mouseMoved(gcn::MouseEvent &event) return; const int itemId = dropShortcut->getItem(index); - const int itemColor = dropShortcut->getItemColor(index); + const unsigned char itemColor = dropShortcut->getItemColor(index); if (itemId < 0) return; diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp index 714435d21..735cea43d 100644 --- a/src/gui/widgets/itemshortcutcontainer.cpp +++ b/src/gui/widgets/itemshortcutcontainer.cpp @@ -140,7 +140,7 @@ void ItemShortcutContainer::draw(gcn::Graphics *graphics) g->drawText(key, itemX + 2, itemY + 2, gcn::Graphics::LEFT); const int itemId = itemShortcut[mNumber]->getItem(i); - const int itemColor = itemShortcut[mNumber]->getItemColor(i); + const unsigned char itemColor = itemShortcut[mNumber]->getItemColor(i); if (itemId < 0) continue; @@ -245,7 +245,8 @@ void ItemShortcutContainer::mouseDragged(gcn::MouseEvent &event) return; const int itemId = itemShortcut[mNumber]->getItem(index); - const int itemColor = itemShortcut[mNumber]->getItemColor(index); + const unsigned char itemColor = itemShortcut[mNumber]-> + getItemColor(index); if (itemId < 0) return; @@ -365,7 +366,7 @@ void ItemShortcutContainer::mouseMoved(gcn::MouseEvent &event) return; const int itemId = itemShortcut[mNumber]->getItem(index); - const int itemColor = itemShortcut[mNumber]->getItemColor(index); + const unsigned char itemColor = itemShortcut[mNumber]->getItemColor(index); if (itemId < 0) return; diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp index 7f539d79f..bbc809747 100644 --- a/src/gui/widgets/setupitem.cpp +++ b/src/gui/widgets/setupitem.cpp @@ -848,7 +848,7 @@ void SetupItemSlider2::action(const gcn::ActionEvent &event A_UNUSED) void SetupItemSlider2::updateLabel() { - int val = mSlider->getValue() - mMin; + int val = static_cast<int>(mSlider->getValue()) - mMin; if (val < 0) val = 0; else if (val >= static_cast<signed>(mValues->size())) diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index 8f543e3bf..3d106f9a2 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -174,7 +174,7 @@ void TextField::keyPressed(gcn::KeyEvent &keyEvent) if ((val >= '0' && val <= '9') || (val == '-' && !mCaretPosition)) { char buf[2]; - buf[0] = val; + buf[0] = static_cast<char>(val); buf[1] = 0; mText.insert(mCaretPosition, std::string(buf)); mCaretPosition += 1; |