From e26c01fe66bc698555fdee9d681b3abd6822848a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 22 Aug 2017 00:17:03 +0300 Subject: Remove some parentheses. --- src/actormanager.cpp | 6 +++--- src/being/playerrelations.cpp | 2 +- src/gui/fonts/textchunk.cpp | 4 ++-- src/gui/fonts/textchunksmall.cpp | 5 +++-- src/gui/mouseoverlink.h | 4 ++-- src/gui/viewport.cpp | 4 ++-- src/gui/widgets/button.cpp | 2 +- src/gui/widgets/itemcontainer.cpp | 8 ++++---- src/gui/widgets/widget.cpp | 2 +- src/gui/windows/inventorywindow.cpp | 2 +- src/gui/windows/tradewindow.cpp | 2 +- src/input/inputmanager.cpp | 4 ++-- src/input/joystick.cpp | 2 +- src/input/key.cpp | 11 ++++++----- src/net/serverinfo.h | 10 ++++++---- src/render/sdlgraphics.cpp | 2 +- src/resources/map/speciallayer.cpp | 2 +- src/resources/sdlgfxblitfunc.cpp | 2 +- src/resources/sprite/animatedsprite.cpp | 4 ++-- src/resources/wallpaper.cpp | 3 ++- src/utils/stringutils.cpp | 5 ++++- 21 files changed, 47 insertions(+), 39 deletions(-) diff --git a/src/actormanager.cpp b/src/actormanager.cpp index 2649cb230..fd24147e9 100644 --- a/src/actormanager.cpp +++ b/src/actormanager.cpp @@ -95,11 +95,11 @@ class FindBeingFunctor final const Vector &pos = b->getPixelPositionF(); // +++ probably here need use int positions and not float? // but for now correct int positions only in Being - return (CAST_U32(pos.x) / mapTileSize == x && + return CAST_U32(pos.x) / mapTileSize == x && (CAST_U32(pos.y) / mapTileSize == y || CAST_U32(pos.y) / mapTileSize == other_y) && b->isAlive() && (type == ActorType::Unknown - || b->getType() == type)); + || b->getType() == type); } uint16_t x, y; @@ -189,7 +189,7 @@ class SortBeingFunctor final return w1 < w2; } - return (being1->getName() < being2->getName()); + return being1->getName() < being2->getName(); } StringIntMap *attackBeings; StringIntMap *priorityBeings; diff --git a/src/being/playerrelations.cpp b/src/being/playerrelations.cpp index a1e9a457c..fe774432b 100644 --- a/src/being/playerrelations.cpp +++ b/src/being/playerrelations.cpp @@ -613,7 +613,7 @@ bool PlayerRelationsManager::isGoodName(Being *const being) const if (being == nullptr) return false; if (being->getGoodStatus() != -1) - return (being->getGoodStatus() == 1); + return being->getGoodStatus() == 1; const std::string &name = being->getName(); const size_t size = name.size(); diff --git a/src/gui/fonts/textchunk.cpp b/src/gui/fonts/textchunk.cpp index 694790881..22dcd18dc 100644 --- a/src/gui/fonts/textchunk.cpp +++ b/src/gui/fonts/textchunk.cpp @@ -89,8 +89,8 @@ TextChunk::~TextChunk() bool TextChunk::operator==(const TextChunk &restrict chunk) const { - return (chunk.text == text && chunk.color == color - && chunk.color2 == color2); + return chunk.text == text && chunk.color == color + && chunk.color2 == color2; } void TextChunk::generate(TTF_Font *restrict const font, diff --git a/src/gui/fonts/textchunksmall.cpp b/src/gui/fonts/textchunksmall.cpp index c7fbf6051..73e8ad386 100644 --- a/src/gui/fonts/textchunksmall.cpp +++ b/src/gui/fonts/textchunksmall.cpp @@ -50,8 +50,9 @@ TextChunkSmall &TextChunkSmall::operator=(const TextChunkSmall &chunk) bool TextChunkSmall::operator==(const TextChunkSmall &chunk) const { - return (chunk.text == text && chunk.color == color - && chunk.color2 == color2); + return chunk.text == text && + chunk.color == color && + chunk.color2 == color2; } bool TextChunkSmall::operator<(const TextChunkSmall &chunk) const diff --git a/src/gui/mouseoverlink.h b/src/gui/mouseoverlink.h index a26d38d6b..758d02b6e 100644 --- a/src/gui/mouseoverlink.h +++ b/src/gui/mouseoverlink.h @@ -39,10 +39,10 @@ struct MouseOverLink final bool operator() (const BrowserLink &link) const { - return (mX >= link.x1 && + return mX >= link.x1 && mX < link.x2 && mY >= link.y1 && - mY < link.y2); + mY < link.y2; } const int mX; const int mY; diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 168ec317a..5715eae3a 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -467,8 +467,8 @@ bool Viewport::leftMouseAction() case ActorType::SkillUnit: if (!stopAttack) { - if ((localPlayer->withinAttackRange(mHoverBeing) || - inputManager.isActionActive(InputAction::ATTACK))) + if (localPlayer->withinAttackRange(mHoverBeing) || + inputManager.isActionActive(InputAction::ATTACK)) { validateSpeed(); if (!mStatsReUpdated && localPlayer != mHoverBeing) diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp index df46014a3..d09a6b3cb 100644 --- a/src/gui/widgets/button.cpp +++ b/src/gui/widgets/button.cpp @@ -873,7 +873,7 @@ void Button::keyReleased(KeyEvent& event) bool Button::isPressed2() const { - return (mPressed || isPressed()); + return mPressed || isPressed(); } bool Button::isPressed() const diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index 3d5c3829f..8dd0f1210 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -101,7 +101,7 @@ namespace return item1->getInvIndex() < item2->getInvIndex(); } - return (name1 < name2); + return name1 < name2; } } itemAlphaInvSorter; @@ -151,7 +151,7 @@ namespace return pair1->mItem->getInvIndex() < pair2->mItem->getInvIndex(); } - return (name1 < name2); + return name1 < name2; } return w1 < w2; } @@ -181,7 +181,7 @@ namespace return pair1->mItem->getInvIndex() < pair2->mItem->getInvIndex(); } - return (name1 < name2); + return name1 < name2; } return c1 < c2; } @@ -211,7 +211,7 @@ namespace return pair1->mItem->getInvIndex() < pair2->mItem->getInvIndex(); } - return (name1 < name2); + return name1 < name2; } return t1 < t2; } diff --git a/src/gui/widgets/widget.cpp b/src/gui/widgets/widget.cpp index 8b49fddfd..47d2e0f5b 100644 --- a/src/gui/widgets/widget.cpp +++ b/src/gui/widgets/widget.cpp @@ -184,7 +184,7 @@ bool Widget::isFocused() const if (mFocusHandler == nullptr) return false; - return (mFocusHandler->isFocused(this)); + return mFocusHandler->isFocused(this); } void Widget::setFocusable(const bool focusable) diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index 27caa2019..cd688be9b 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -558,7 +558,7 @@ void InventoryWindow::mouseClicked(MouseEvent &event) const bool mod = (isStorageActive() && inputManager.isActionActive(InputAction::STOP_ATTACK)); - const bool mod2 = ((tradeWindow != nullptr) && + const bool mod2 = (tradeWindow != nullptr && tradeWindow->isWindowVisible() && inputManager.isActionActive(InputAction::STOP_ATTACK)); diff --git a/src/gui/windows/tradewindow.cpp b/src/gui/windows/tradewindow.cpp index 143a625e7..66f4e0550 100644 --- a/src/gui/windows/tradewindow.cpp +++ b/src/gui/windows/tradewindow.cpp @@ -549,5 +549,5 @@ bool TradeWindow::checkItem(const Item *const item) const bool TradeWindow::isInpupFocused() const { - return ((mMoneyField != nullptr) && mMoneyField->isFocused()); + return mMoneyField != nullptr && mMoneyField->isFocused(); } diff --git a/src/input/inputmanager.cpp b/src/input/inputmanager.cpp index 814e2ac76..b0aa18da5 100644 --- a/src/input/inputmanager.cpp +++ b/src/input/inputmanager.cpp @@ -816,8 +816,8 @@ bool InputManager::checkKey(const InputActionData *restrict const key) const if ((key == nullptr) || (key->condition & mMask) != key->condition) return false; - return (key->modKeyIndex == InputAction::NO_VALUE - || isActionActive0(key->modKeyIndex)); + return key->modKeyIndex == InputAction::NO_VALUE + || isActionActive0(key->modKeyIndex); } bool InputManager::invokeKey(const InputActionData *restrict const key, diff --git a/src/input/joystick.cpp b/src/input/joystick.cpp index 0c859f50d..e01177059 100644 --- a/src/input/joystick.cpp +++ b/src/input/joystick.cpp @@ -349,7 +349,7 @@ bool Joystick::validate() const if (mCalibrating || !mEnabled || !mCalibrated) return false; - return (mUseInactive || settings.inputFocused); + return mUseInactive || settings.inputFocused; } void Joystick::handleRepeat(const int time) diff --git a/src/input/key.cpp b/src/input/key.cpp index 97019e67e..13646dc8e 100644 --- a/src/input/key.cpp +++ b/src/input/key.cpp @@ -88,10 +88,11 @@ bool Key::isNumber() const bool Key::isLetter() const { - return (((mValue >= 65 && mValue <= 90) - || (mValue >= 97 && mValue <= 122) - || (mValue >= 192 && mValue <= 255)) - && (mValue != 215) && (mValue != 247)); + return ((mValue >= 65 && mValue <= 90) || + (mValue >= 97 && mValue <= 122) || + (mValue >= 192 && mValue <= 255)) && + mValue != 215 && + mValue != 247; } int Key::getValue() const @@ -106,5 +107,5 @@ bool Key::operator==(const Key& key) const bool Key::operator!=(const Key& key) const { - return (mValue != key.mValue); + return mValue != key.mValue; } diff --git a/src/net/serverinfo.h b/src/net/serverinfo.h index f5da554ee..2bdec0251 100644 --- a/src/net/serverinfo.h +++ b/src/net/serverinfo.h @@ -181,14 +181,16 @@ class ServerInfo final bool operator==(const ServerInfo &other) const { - return (name == other.name && hostname == other.hostname && - port == other.port); + return name == other.name && + hostname == other.hostname && + port == other.port; } bool operator!=(const ServerInfo &other) const { - return (name != other.name || hostname != other.hostname || - port != other.port); + return name != other.name || + hostname != other.hostname || + port != other.port; } static ServerTypeT parseType(const std::string &serverType) diff --git a/src/render/sdlgraphics.cpp b/src/render/sdlgraphics.cpp index bf4e1a258..9220f530e 100644 --- a/src/render/sdlgraphics.cpp +++ b/src/render/sdlgraphics.cpp @@ -1054,7 +1054,7 @@ void SDLGraphics::fillRectangle(const Rect &restrict rectangle) restrict2 const unsigned pb = (pixel & bMask) * mColor.a; const unsigned pg = (pixel & gMask) * mColor.a; const unsigned pr = (pixel & rMask) * mColor.a; - const unsigned a0 = (255 - mColor.a); + const unsigned a0 = 255 - mColor.a; const unsigned int a1 = a0 * bShift; const unsigned int a2 = a0 * gShift; diff --git a/src/resources/map/speciallayer.cpp b/src/resources/map/speciallayer.cpp index 27713e074..ad186c2d9 100644 --- a/src/resources/map/speciallayer.cpp +++ b/src/resources/map/speciallayer.cpp @@ -104,7 +104,7 @@ void SpecialLayer::addRoad(const Path &road) { FOR_EACH (Path::const_iterator, i, road) { - const Position &pos = (*i); + const Position &pos = *i; MapItem *const item = getTile(pos.x, pos.y); if (item == nullptr) setTile(pos.x, pos.y, new MapItem(MapItemType::ROAD)); diff --git a/src/resources/sdlgfxblitfunc.cpp b/src/resources/sdlgfxblitfunc.cpp index 6efce719a..d5e3268c7 100644 --- a/src/resources/sdlgfxblitfunc.cpp +++ b/src/resources/sdlgfxblitfunc.cpp @@ -430,7 +430,7 @@ static int _SDL_gfxBlitRGBACall(const SDL_Surface *const src, return 1; } - return (0); + return 0; } int SDLgfxBlitRGBA(SDL_Surface *const src, diff --git a/src/resources/sprite/animatedsprite.cpp b/src/resources/sprite/animatedsprite.cpp index 4905f2f3e..30eb4dda3 100644 --- a/src/resources/sprite/animatedsprite.cpp +++ b/src/resources/sprite/animatedsprite.cpp @@ -237,8 +237,8 @@ bool AnimatedSprite::updateCurrentAnimation(const unsigned int time) restrict2 mFrameIndex = 0; mFrame = &mAnimation->mFrames[mFrameIndex]; - if ((mFrame->type == FrameType::LABEL && - !mFrame->nextAction.empty())) + if (mFrame->type == FrameType::LABEL && + !mFrame->nextAction.empty()) { fail = false; } diff --git a/src/resources/wallpaper.cpp b/src/resources/wallpaper.cpp index dfaca1f30..9e81f53a7 100644 --- a/src/resources/wallpaper.cpp +++ b/src/resources/wallpaper.cpp @@ -80,7 +80,8 @@ static bool wallpaperCompare(const WallpaperData &a, const WallpaperData &b) const int aa = a.width * a.height; const int ab = b.width * b.height; - return (aa > ab || (aa == ab && a.width > b.width)); + return aa > ab || + (aa == ab && a.width > b.width); } void Wallpaper::loadWallpapers() diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp index ecbd7de19..4f3a156cc 100644 --- a/src/utils/stringutils.cpp +++ b/src/utils/stringutils.cpp @@ -157,7 +157,10 @@ int compareStrI(const std::string &a, const std::string &b) bool isWordSeparator(const signed char chr) { - return (chr == ' ' || chr == ',' || chr == '.' || chr == '"'); + return chr == ' ' || + chr == ',' || + chr == '.' || + chr == '"'; } const std::string findSameSubstring(const std::string &restrict str1, -- cgit v1.2.3-60-g2f50