diff options
author | Andrei Karas <akaras@inbox.ru> | 2018-10-29 02:02:04 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2018-10-29 02:02:04 +0300 |
commit | a6d18b282ab916c6536dc25516affeb9200043b6 (patch) | |
tree | 9980735a47cb2118999fb4f4dceaa52bf9f4fae7 /src/gui | |
parent | 98c74738f21d7ae256f1273b6c1614ee64e2a3ad (diff) | |
download | mv-s20181102.tar.gz mv-s20181102.tar.bz2 mv-s20181102.tar.xz mv-s20181102.zip |
Fix code style.s20181102
Diffstat (limited to 'src/gui')
27 files changed, 52 insertions, 52 deletions
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 8df7c384a..1f8589b50 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -1526,7 +1526,7 @@ void Gui::handleModalFocusReleased() int Gui::getMousePressLength() const { - if (mLastMousePressTimeStamp == 0u) + if (mLastMousePressTimeStamp == 0U) return 0; unsigned int ticks = SDL_GetTicks(); if (ticks > mLastMousePressTimeStamp) diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 03398c6b5..1d4745110 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -2592,7 +2592,7 @@ void PopupMenu::addFollow() void PopupMenu::addBuySell(const Being *const being) { - if ((playerRelations.getDefault() & PlayerRelation::TRADE) != 0u) + if ((playerRelations.getDefault() & PlayerRelation::TRADE) != 0U) { mBrowserBox->addSeparator("##3---"); const bool haveVending = @@ -2626,7 +2626,7 @@ void PopupMenu::addBuySell(const Being *const being) void PopupMenu::addBuySellDefault() { - if ((playerRelations.getDefault() & PlayerRelation::TRADE) != 0u) + if ((playerRelations.getDefault() & PlayerRelation::TRADE) != 0U) { mBrowserBox->addSeparator("##3---"); // TRANSLATORS: popup menu item diff --git a/src/gui/sdlinput.cpp b/src/gui/sdlinput.cpp index 59d964641..f1da58cbc 100644 --- a/src/gui/sdlinput.cpp +++ b/src/gui/sdlinput.cpp @@ -278,7 +278,7 @@ void SDLInput::pushInput(const SDL_Event &event) * application loses its mousefocus. */ if ((event.active.state & SDL_APPMOUSEFOCUS) != 0 && - event.active.gain == 0u) + event.active.gain == 0U) { mMouseInWindow = false; @@ -294,7 +294,7 @@ void SDLInput::pushInput(const SDL_Event &event) } if ((event.active.state & SDL_APPMOUSEFOCUS) != 0 && - event.active.gain != 0u) + event.active.gain != 0U) { mMouseInWindow = true; } diff --git a/src/gui/sdlinput.h b/src/gui/sdlinput.h index 9ccd34f04..782604bd4 100644 --- a/src/gui/sdlinput.h +++ b/src/gui/sdlinput.h @@ -331,7 +331,7 @@ class SDLInput final } PRAGMA45(GCC diagnostic pop) - if ((CAST_U32(keysym.mod) & KMOD_NUM) == 0u) + if ((CAST_U32(keysym.mod) & KMOD_NUM) == 0U) { PRAGMA45(GCC diagnostic push) PRAGMA45(GCC diagnostic ignored "-Wswitch-enum") diff --git a/src/gui/shortcut/emoteshortcut.cpp b/src/gui/shortcut/emoteshortcut.cpp index 68c609ea2..26f9ce946 100644 --- a/src/gui/shortcut/emoteshortcut.cpp +++ b/src/gui/shortcut/emoteshortcut.cpp @@ -68,7 +68,7 @@ void EmoteShortcut::save() const { for (int i = 0; i < SHORTCUT_EMOTES; i++) { - const unsigned char emoteId = mEmotes[i] != 0u ? mEmotes[i] + const unsigned char emoteId = mEmotes[i] != 0U ? mEmotes[i] : CAST_U8(0); serverConfig.setValue("emoteshortcut" + toString(i), CAST_U32(emoteId)); diff --git a/src/gui/shortcut/emoteshortcut.h b/src/gui/shortcut/emoteshortcut.h index fd6ebd777..65f7aa86d 100644 --- a/src/gui/shortcut/emoteshortcut.h +++ b/src/gui/shortcut/emoteshortcut.h @@ -101,7 +101,7 @@ class EmoteShortcut final * A flag to check if the Emote is selected. */ bool isEmoteSelected() const noexcept2 A_WARN_UNUSED - { return mEmoteSelected != 0u; } + { return mEmoteSelected != 0U; } /** * Remove a Emote from the shortcut. diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index c345e6911..c6d1e1bd1 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -965,7 +965,7 @@ ImageSet *Theme::getImageSetFromThemeXml(const std::string &name, { Image *const image = rect.grid[0]; const SDL_Rect &rect2 = image->mBounds; - if ((rect2.w != 0u) && (rect2.h != 0u)) + if ((rect2.w != 0U) && (rect2.h != 0U)) { ImageSet *const imageSet = Loader::getSubImageSet( image, w, h); diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index ab87076d9..7354dbabf 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -426,7 +426,7 @@ void BrowserBox::draw(Graphics *const graphics) if (mSelectedLink >= 0 && mSelectedLink < CAST_S32(mLinks.size())) { - if ((mHighlightMode & LinkHighlightMode::BACKGROUND) != 0u) + if ((mHighlightMode & LinkHighlightMode::BACKGROUND) != 0U) { BrowserLink &link = mLinks[CAST_SIZE(mSelectedLink)]; graphics->setColor(mHighlightColor); @@ -437,7 +437,7 @@ void BrowserBox::draw(Graphics *const graphics) link.y2 - link.y1)); } - if ((mHighlightMode & LinkHighlightMode::UNDERLINE) != 0u) + if ((mHighlightMode & LinkHighlightMode::UNDERLINE) != 0U) { BrowserLink &link = mLinks[CAST_SIZE(mSelectedLink)]; graphics->setColor(mHyperLinkColor); @@ -458,7 +458,7 @@ void BrowserBox::draw(Graphics *const graphics) continue; if (part.mY > yEnd) break; - if (part.mType == 0u) + if (part.mType == 0U) { if (part.mBold) { diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp index ad597ee60..f3d7e7446 100644 --- a/src/gui/widgets/emoteshortcutcontainer.cpp +++ b/src/gui/widgets/emoteshortcutcontainer.cpp @@ -216,7 +216,7 @@ void EmoteShortcutContainer::mousePressed(MouseEvent &restrict event) restrict2 emoteShortcut->setEmote(index); emoteShortcut->setEmoteSelected(0); } - else if (emoteShortcut->getEmote(index) != 0u) + else if (emoteShortcut->getEmote(index) != 0U) { mEmoteClicked = true; } @@ -250,12 +250,12 @@ void EmoteShortcutContainer::mouseReleased(MouseEvent &restrict event) return; } - if (mEmoteMoved != 0u) + if (mEmoteMoved != 0U) { emoteShortcut->setEmotes(index, mEmoteMoved); mEmoteMoved = 0; } - else if ((emoteShortcut->getEmote(index) != 0u) && mEmoteClicked) + else if ((emoteShortcut->getEmote(index) != 0U) && mEmoteClicked) { emoteShortcut->useEmote(index + 1); } diff --git a/src/gui/widgets/extendedlistbox.cpp b/src/gui/widgets/extendedlistbox.cpp index dc8ead760..b15aee7d2 100644 --- a/src/gui/widgets/extendedlistbox.cpp +++ b/src/gui/widgets/extendedlistbox.cpp @@ -41,7 +41,7 @@ ExtendedListBox::ExtendedListBox(const Widget2 *const widget, mListItems(), mSelectedItems() { - if (rowHeight != 0u) + if (rowHeight != 0U) mRowHeight = rowHeight; } diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp index e815a4ec8..5f13f9bc7 100644 --- a/src/gui/widgets/listbox.cpp +++ b/src/gui/widgets/listbox.cpp @@ -357,7 +357,7 @@ void ListBox::mouseDragged(MouseEvent &event) return; // Make list selection update on drag, but guard against negative y - if (getRowHeight() != 0u) + if (getRowHeight() != 0U) setSelected(std::max(0, getSelectionByMouse(event.getY()))); } diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp index 8cc053699..d8f01a644 100644 --- a/src/gui/widgets/shoplistbox.cpp +++ b/src/gui/widgets/shoplistbox.cpp @@ -209,7 +209,7 @@ void ShopListBox::setPriceCheck(const bool check) void ShopListBox::mouseMoved(MouseEvent &event) { - if ((itemPopup == nullptr) || (mRowHeight == 0u)) + if ((itemPopup == nullptr) || (mRowHeight == 0U)) return; if (mShopItems == nullptr) diff --git a/src/gui/widgets/staticbrowserbox.cpp b/src/gui/widgets/staticbrowserbox.cpp index cd67991b7..c4a705aa9 100644 --- a/src/gui/widgets/staticbrowserbox.cpp +++ b/src/gui/widgets/staticbrowserbox.cpp @@ -375,7 +375,7 @@ void StaticBrowserBox::draw(Graphics *const graphics) if (mSelectedLink >= 0 && mSelectedLink < CAST_S32(mLinks.size())) { - if ((mHighlightMode & LinkHighlightMode::BACKGROUND) != 0u) + if ((mHighlightMode & LinkHighlightMode::BACKGROUND) != 0U) { BrowserLink &link = mLinks[CAST_SIZE(mSelectedLink)]; graphics->setColor(mHighlightColor); @@ -386,7 +386,7 @@ void StaticBrowserBox::draw(Graphics *const graphics) link.y2 - link.y1)); } - if ((mHighlightMode & LinkHighlightMode::UNDERLINE) != 0u) + if ((mHighlightMode & LinkHighlightMode::UNDERLINE) != 0U) { BrowserLink &link = mLinks[CAST_SIZE(mSelectedLink)]; graphics->setColor(mHyperLinkColor); @@ -407,7 +407,7 @@ void StaticBrowserBox::draw(Graphics *const graphics) continue; if (part.mY > yEnd) break; - if (part.mType == 0u) + if (part.mType == 0U) { if (part.mBold) { diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index 37fb7637e..59882966c 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -516,7 +516,7 @@ void TabbedArea::widgetResized(const Event &event A_UNUSED) innerWidth = 0; int newWidth = mVisibleTabsWidth; - while ((mTabScrollIndex != 0u) && newWidth < innerWidth) + while ((mTabScrollIndex != 0U) && newWidth < innerWidth) { Tab *const tab = mTabs[mTabScrollIndex - 1].first; if ((tab != nullptr) && tab->mVisible == Visible_true) @@ -659,7 +659,7 @@ void TabbedArea::action(const ActionEvent& actionEvent) const std::string &eventId = actionEvent.getId(); if (eventId == "shift_left") { - if (mTabScrollIndex != 0u) + if (mTabScrollIndex != 0U) --mTabScrollIndex; } else if (eventId == "shift_right") @@ -694,7 +694,7 @@ void TabbedArea::updateArrowEnableState() } // Left arrow consistency check - if (mTabScrollIndex == 0u) + if (mTabScrollIndex == 0U) mArrowButton[0]->setEnabled(false); else mArrowButton[0]->setEnabled(true); diff --git a/src/gui/widgets/tabs/setup_relations.cpp b/src/gui/widgets/tabs/setup_relations.cpp index 85a861109..e89c2a3e0 100644 --- a/src/gui/widgets/tabs/setup_relations.cpp +++ b/src/gui/widgets/tabs/setup_relations.cpp @@ -71,11 +71,11 @@ Setup_Relations::Setup_Relations(const Widget2 *const widget) : mPlayerTable, Opaque_true, std::string())), // TRANSLATORS: relation dialog button mDefaultTrading(new CheckBox(this, _("Allow trading"), - (playerRelations.getDefault() & PlayerRelation::TRADE) != 0u, + (playerRelations.getDefault() & PlayerRelation::TRADE) != 0U, nullptr, std::string())), // TRANSLATORS: relation dialog button mDefaultWhisper(new CheckBox(this, _("Allow whispers"), - (playerRelations.getDefault() & PlayerRelation::WHISPER) != 0u, + (playerRelations.getDefault() & PlayerRelation::WHISPER) != 0U, nullptr, std::string())), // TRANSLATORS: relation dialog button mDeleteButton(new Button(this, _("Delete"), ACTION_DELETE, @@ -236,9 +236,9 @@ void Setup_Relations::updatedPlayer(const std::string &name A_UNUSED) { mPlayerTableModel->playerRelationsUpdated(); mDefaultTrading->setSelected( - (playerRelations.getDefault() & PlayerRelation::TRADE) != 0u); + (playerRelations.getDefault() & PlayerRelation::TRADE) != 0U); mDefaultWhisper->setSelected( - (playerRelations.getDefault() & PlayerRelation::WHISPER) != 0u); + (playerRelations.getDefault() & PlayerRelation::WHISPER) != 0U); if (localPlayer != nullptr) localPlayer->updateName(); } @@ -265,7 +265,7 @@ void Setup_Relations::updateAll() void Setup_Relations::externalUpdated() { mDefaultTrading->setSelected( - (playerRelations.getDefault() & PlayerRelation::TRADE) != 0u); + (playerRelations.getDefault() & PlayerRelation::TRADE) != 0U); mDefaultWhisper->setSelected( - (playerRelations.getDefault() & PlayerRelation::WHISPER) != 0u); + (playerRelations.getDefault() & PlayerRelation::WHISPER) != 0U); } diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index b80404c73..adcb557d7 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -322,7 +322,7 @@ void TextField::keyPressed(KeyEvent &event) if (mNumeric) { if ((val >= '0' && val <= '9') || - (val == '-' && mCaretPosition == 0u)) + (val == '-' && mCaretPosition == 0U)) { char buf[2]; buf[0] = CAST_8(val); diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index cdc10f1af..3df552404 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -213,7 +213,7 @@ Window::Window(const std::string &caption, } setTitleBarHeight(CAST_U32( getOption("titlebarHeight", 0))); - if (mTitleBarHeight == 0u) + if (mTitleBarHeight == 0U) mTitleBarHeight = mCaptionFont->getHeight() + mPadding; mTitleBarHeight += getOption("titlebarHeightRelative", 0); diff --git a/src/gui/windowmanager.cpp b/src/gui/windowmanager.cpp index be5a5b152..d4923c478 100644 --- a/src/gui/windowmanager.cpp +++ b/src/gui/windowmanager.cpp @@ -247,7 +247,7 @@ void WindowManager::updateTitle() void WindowManager::setFramerate(const unsigned int fpsLimit) { - if (fpsLimit == 0u) + if (fpsLimit == 0U) return; if (!settings.limitFps) diff --git a/src/gui/windows/charcreatedialog.cpp b/src/gui/windows/charcreatedialog.cpp index 49dcd8314..852dbc2cc 100644 --- a/src/gui/windows/charcreatedialog.cpp +++ b/src/gui/windows/charcreatedialog.cpp @@ -163,12 +163,12 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent, beingSlot.cardsId); } - if (maxHairColor == 0u) + if (maxHairColor == 0U) maxHairColor = ColorDB::getHairSize(); - if (maxHairStyle == 0u) + if (maxHairStyle == 0U) maxHairStyle = ItemDB::getNumOfHairstyles(); - if (maxHairStyle != 0u) + if (maxHairStyle != 0U) { mHairStyle = (CAST_U32(rand()) % maxHairStyle) + minHairStyle; @@ -177,7 +177,7 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent, { mHairStyle = 0; } - if (maxHairColor != 0u) + if (maxHairColor != 0U) { mHairColor = (CAST_U32(rand()) % maxHairColor) + minHairColor; diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index a33bb4ec8..560826d79 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -883,7 +883,7 @@ void ChatWindow::keyPressed(KeyEvent &event) const ChatTab *const tab = getFocused(); if ((tab != nullptr) && tab->hasRows()) { - if (mChatHistoryIndex == 0u) + if (mChatHistoryIndex == 0U) { mChatHistoryIndex = CAST_U32( tab->getRows().size()); diff --git a/src/gui/windows/equipmentwindow.cpp b/src/gui/windows/equipmentwindow.cpp index ed59cab7d..7d0284fc1 100644 --- a/src/gui/windows/equipmentwindow.cpp +++ b/src/gui/windows/equipmentwindow.cpp @@ -352,7 +352,7 @@ void EquipmentWindow::action(const ActionEvent &event) PlayerInfo::unequipItem(item, Sfx_true); setSelected(-1); } - else if (eventId.find("tab_") == 0u) + else if (eventId.find("tab_") == 0U) { Button *const button = dynamic_cast<Button*>(event.getSource()); if (button == nullptr) diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index f198743ec..be036a558 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -514,7 +514,7 @@ void InventoryWindow::action(const ActionEvent &event) mItems->setName(mNameFilter->getText()); mItems->updateMatrix(); } - else if (eventId.find("tag_") == 0u) + else if (eventId.find("tag_") == 0U) { std::string tagName = event.getId().substr(4); mItems->setFilter(ItemDB::getTagId(tagName)); diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp index 0abce52ca..7a671c987 100644 --- a/src/gui/windows/npcdialog.cpp +++ b/src/gui/windows/npcdialog.cpp @@ -1354,7 +1354,7 @@ std::string NpcDialog::complexItemToStr(const ComplexItem *const item) { const STD_VECTOR<Item*> &items = item->getChilds(); const size_t sz = items.size(); - if (sz == 0u) + if (sz == 0U) return str; const Item *item2 = items[0]; diff --git a/src/gui/windows/outfitwindow.cpp b/src/gui/windows/outfitwindow.cpp index 8a36bca6c..365ccbfc4 100644 --- a/src/gui/windows/outfitwindow.cpp +++ b/src/gui/windows/outfitwindow.cpp @@ -74,7 +74,7 @@ OutfitWindow::OutfitWindow() : nullptr, std::string())), // TRANSLATORS: outfits window checkbox mAwayOutfitCheck(new CheckBox(this, _("Away outfit"), - serverConfig.getValue("OutfitAwayIndex", OUTFITS_COUNT - 1) != 0u, + serverConfig.getValue("OutfitAwayIndex", OUTFITS_COUNT - 1) != 0U, nullptr, std::string())), // TRANSLATORS: outfits window label mKeyLabel(new Label(this, strprintf(_("Key: %s"), diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp index a8db9302d..9656d0c1c 100644 --- a/src/gui/windows/serverdialog.cpp +++ b/src/gui/windows/serverdialog.cpp @@ -868,11 +868,11 @@ int ServerDialog::downloadUpdate(void *ptr, else { float progress = static_cast<float>(remaining); - if (total != 0u) + if (total != 0U) progress /= static_cast<float>(total); if (progress != progress || progress < 0.0F) - progress = 0.0f; + progress = 0.0F; else if (progress > 1.0F) progress = 1.0F; diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index e60465367..39235c570 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -595,25 +595,25 @@ void SkillDialog::loadSkillData(XmlNodeConstPtr node, missile.particle = XML::getProperty( node, "missile-particle", ""); missile.z = XML::getFloatProperty( - node, "missile-z", 32.0f); + node, "missile-z", 32.0F); missile.lifeTime = XML::getProperty( node, "missile-lifetime", 500); missile.speed = XML::getFloatProperty( - node, "missile-speed", 7.0f); + node, "missile-speed", 7.0F); missile.dieDistance = XML::getFloatProperty( - node, "missile-diedistance", 8.0f); + node, "missile-diedistance", 8.0F); MissileInfo &castingMissile = data->castingMissile; castingMissile.particle = XML::getProperty( node, "castingMissile-particle", ""); castingMissile.z = XML::getFloatProperty( - node, "castingMissile-z", 32.0f); + node, "castingMissile-z", 32.0F); castingMissile.lifeTime = XML::getProperty( node, "castingMissile-lifetime", 500); castingMissile.speed = XML::getFloatProperty( - node, "castingMissile-speed", 7.0f); + node, "castingMissile-speed", 7.0F); castingMissile.dieDistance = XML::getFloatProperty( - node, "castingMissile-diedistance", 8.0f); + node, "castingMissile-diedistance", 8.0F); data->castingAnimation = XML::getProperty( node, diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp index a4b01a050..c7b5ef8b0 100644 --- a/src/gui/windows/updaterwindow.cpp +++ b/src/gui/windows/updaterwindow.cpp @@ -395,7 +395,7 @@ void UpdaterWindow::loadNews() { firstLine = false; const size_t i = line.find("##9 Latest client version: ##6"); - if (i == 0u) + if (i == 0U) continue; if (file.is_open()) @@ -529,7 +529,7 @@ int UpdaterWindow::updateProgress(void *ptr, } } - if (dt == 0u) + if (dt == 0U) dt = 1; float progress = static_cast<float>(dn) / |