diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-04-30 19:52:16 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-04-30 19:52:16 +0300 |
commit | 88c6a0aa757df0ec38bc67f2cf314f8be3efd0ce (patch) | |
tree | b35a28cd317e2895c063749180b98edfe223c032 /src/gui/windows | |
parent | c24fefa91a1416a4dad7fd97d67cefa51f9eb97c (diff) | |
download | manaverse-88c6a0aa757df0ec38bc67f2cf314f8be3efd0ce.tar.gz manaverse-88c6a0aa757df0ec38bc67f2cf314f8be3efd0ce.tar.bz2 manaverse-88c6a0aa757df0ec38bc67f2cf314f8be3efd0ce.tar.xz manaverse-88c6a0aa757df0ec38bc67f2cf314f8be3efd0ce.zip |
Fix code style in gui.
Diffstat (limited to 'src/gui/windows')
-rw-r--r-- | src/gui/windows/botcheckerwindow.cpp | 4 | ||||
-rw-r--r-- | src/gui/windows/charcreatedialog.cpp | 6 | ||||
-rw-r--r-- | src/gui/windows/charselectdialog.cpp | 18 | ||||
-rw-r--r-- | src/gui/windows/chatwindow.cpp | 3 | ||||
-rw-r--r-- | src/gui/windows/emotewindow.cpp | 4 | ||||
-rw-r--r-- | src/gui/windows/shortcutwindow.h | 6 | ||||
-rw-r--r-- | src/gui/windows/skilldialog.cpp | 5 | ||||
-rw-r--r-- | src/gui/windows/socialwindow.cpp | 24 | ||||
-rw-r--r-- | src/gui/windows/statuswindow.cpp | 3 | ||||
-rw-r--r-- | src/gui/windows/whoisonline.cpp | 2 |
10 files changed, 50 insertions, 25 deletions
diff --git a/src/gui/windows/botcheckerwindow.cpp b/src/gui/windows/botcheckerwindow.cpp index 32a0227d7..e8dd03f63 100644 --- a/src/gui/windows/botcheckerwindow.cpp +++ b/src/gui/windows/botcheckerwindow.cpp @@ -116,9 +116,9 @@ public: } const unsigned int curTime = cur_time; - const unsigned int sz = mPlayers.size(); + const size_t sz = mPlayers.size(); // set up widgets - for (unsigned int r = 0; r < sz; ++r) + for (size_t r = 0; r < sz; ++r) { if (!mPlayers.at(r)) continue; diff --git a/src/gui/windows/charcreatedialog.cpp b/src/gui/windows/charcreatedialog.cpp index 0fe412e5c..182ce5f03 100644 --- a/src/gui/windows/charcreatedialog.cpp +++ b/src/gui/windows/charcreatedialog.cpp @@ -340,7 +340,8 @@ void CharCreateDialog::action(const ActionEvent &event) Net::getCharServerHandler()->newCharacter(getName(), characterSlot, mFemale->isSelected(), mHairStyle, mHairColor, - static_cast<unsigned char>(mRace), mLook, atts); + static_cast<unsigned char>(mRace), + static_cast<unsigned char>(mLook), atts); } else { @@ -620,7 +621,8 @@ void CharCreateDialog::updateLook() { mLook = 0; } - mPlayer->setSubtype(static_cast<uint16_t>(mRace), mLook); + mPlayer->setSubtype(static_cast<uint16_t>(mRace), + static_cast<uint8_t>(mLook)); if (mRaceNameLabel) { mRaceNameLabel->setCaption(item.getName()); diff --git a/src/gui/windows/charselectdialog.cpp b/src/gui/windows/charselectdialog.cpp index 887937232..4754d01e5 100644 --- a/src/gui/windows/charselectdialog.cpp +++ b/src/gui/windows/charselectdialog.cpp @@ -256,12 +256,18 @@ 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"), - character->data.mAttributes[PlayerInfo::HP], - character->data.mAttributes[PlayerInfo::MAX_HP], - character->data.mAttributes[PlayerInfo::MP], - character->data.mAttributes[PlayerInfo::MAX_MP], - character->data.mAttributes[PlayerInfo::LEVEL], - character->data.mAttributes[PlayerInfo::EXP], + static_cast<uint32_t>( + character->data.mAttributes[PlayerInfo::HP]), + static_cast<uint32_t>( + character->data.mAttributes[PlayerInfo::MAX_HP]), + static_cast<uint32_t>( + character->data.mAttributes[PlayerInfo::MP]), + static_cast<uint32_t>( + character->data.mAttributes[PlayerInfo::MAX_MP]), + static_cast<uint32_t>( + character->data.mAttributes[PlayerInfo::LEVEL]), + static_cast<uint32_t>( + character->data.mAttributes[PlayerInfo::EXP]), Units::formatCurrency( character->data.mAttributes[PlayerInfo::MONEY]).c_str()); new OkDialog(data->getName(), msg, DIALOG_SILENCE); diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index 5b1eba199..1b1973f63 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -1452,7 +1452,8 @@ bool ChatWindow::resortChatLog(std::string line, Own own, { const std::string nick = line.substr(0, idx2 - 1); line = line.substr(idx2 + 6); - localPetEmote(nick, atoi(line.c_str())); + localPetEmote(nick, static_cast<uint8_t>( + atoi(line.c_str()))); } // ignore other special message formats. return false; diff --git a/src/gui/windows/emotewindow.cpp b/src/gui/windows/emotewindow.cpp index 0f286b145..713a6e567 100644 --- a/src/gui/windows/emotewindow.cpp +++ b/src/gui/windows/emotewindow.cpp @@ -153,7 +153,7 @@ std::string EmoteWindow::getSelectedEmote() const return std::string(); char chr[2]; - chr[0] = '0' + index; + chr[0] = static_cast<char>('0' + index); chr[1] = 0; return std::string("%%").append(&chr[0]); } @@ -173,7 +173,7 @@ std::string EmoteWindow::getSelectedColor() const return std::string(); char chr[2]; - chr[0] = '0' + index; + chr[0] = static_cast<char>('0' + index); chr[1] = 0; return std::string("##").append(&chr[0]); } diff --git a/src/gui/windows/shortcutwindow.h b/src/gui/windows/shortcutwindow.h index 5e36e68d7..9a447d05c 100644 --- a/src/gui/windows/shortcutwindow.h +++ b/src/gui/windows/shortcutwindow.h @@ -45,9 +45,9 @@ class ShortcutWindow final : public Window const std::string &restrict skinFile = "", int width = 0, int height = 0); - ShortcutWindow(const std::string &restrict title, - const std::string &restrict skinFile = "", - const int width = 0, const int height = 0); + explicit ShortcutWindow(const std::string &restrict title, + const std::string &restrict skinFile = "", + const int width = 0, const int height = 0); A_DELETE_COPY(ShortcutWindow) diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index f077341bf..0051dd1e7 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -332,7 +332,10 @@ void SkillDialog::action(const ActionEvent &event) if (tab) { if (const SkillInfo *const info = tab->getSelectedInfo()) - Net::getPlayerHandler()->increaseSkill(info->id); + { + Net::getPlayerHandler()->increaseSkill( + static_cast<uint16_t>(info->id)); + } } } else if (eventId == "sel") diff --git a/src/gui/windows/socialwindow.cpp b/src/gui/windows/socialwindow.cpp index 3f6fe663d..6a17514d6 100644 --- a/src/gui/windows/socialwindow.cpp +++ b/src/gui/windows/socialwindow.cpp @@ -277,7 +277,9 @@ public: if (online0 || total0) { // TRANSLATORS: social window label - mCounterString = strprintf(_("Members: %u/%u"), online0, total0); + mCounterString = strprintf(_("Members: %u/%u"), + static_cast<uint32_t>(online0), + static_cast<uint32_t>(total0)); } else { @@ -299,7 +301,9 @@ public: } // TRANSLATORS: social window label - mCounterString = strprintf(_("Players: %u/%u"), online, total); + mCounterString = strprintf(_("Players: %u/%u"), + static_cast<uint32_t>(online), + static_cast<uint32_t>(total)); } updateCounter(); } @@ -369,7 +373,9 @@ public: } // TRANSLATORS: social window label - mCounterString = strprintf(_("Players: %u/%u"), online, total); + mCounterString = strprintf(_("Players: %u/%u"), + static_cast<uint32_t>(online), + static_cast<uint32_t>(total)); updateCounter(); } }; @@ -492,7 +498,9 @@ public: } // TRANSLATORS: social window label - mCounterString = strprintf(_("Players: %u/%u"), online, total); + mCounterString = strprintf(_("Players: %u/%u"), + static_cast<uint32_t>(online), + static_cast<uint32_t>(total)); updateCounter(); } @@ -781,7 +789,9 @@ public: socialWindow->setProcessedPortals(true); // TRANSLATORS: social window label - mCounterString = strprintf(_("Portals: %u/%u"), online, total); + mCounterString = strprintf(_("Portals: %u/%u"), + static_cast<uint32_t>(online), + static_cast<uint32_t>(total)); updateCounter(); } @@ -1157,7 +1167,9 @@ public: delete players; // TRANSLATORS: social window label - mCounterString = strprintf(_("Friends: %u/%u"), online, total); + mCounterString = strprintf(_("Friends: %u/%u"), + static_cast<uint32_t>(online), + static_cast<uint32_t>(total)); updateCounter(); } diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp index 53abb7fdf..f2473241c 100644 --- a/src/gui/windows/statuswindow.cpp +++ b/src/gui/windows/statuswindow.cpp @@ -114,7 +114,8 @@ class DerDisplay final : public AttrDisplay { return DERIVED; } }; -class ChangeDisplay final : public AttrDisplay, ActionListener +class ChangeDisplay final : public AttrDisplay, + public ActionListener { public: ChangeDisplay(const Widget2 *const widget, diff --git a/src/gui/windows/whoisonline.cpp b/src/gui/windows/whoisonline.cpp index b7616eb72..34ae7aa49 100644 --- a/src/gui/windows/whoisonline.cpp +++ b/src/gui/windows/whoisonline.cpp @@ -434,7 +434,7 @@ void WhoIsOnline::loadWebList() level = 0; OnlinePlayer *const player = new OnlinePlayer(nick, - static_cast<signed char>(255), level, + static_cast<unsigned char>(255), level, GENDER_UNSPECIFIED, -1); mOnlinePlayers.insert(player); mOnlineNicks.insert(nick); |