diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-06-09 00:18:08 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-06-09 00:18:08 +0300 |
commit | c6ac11341bd99cbe5eeb4275b9b2473e21338d5e (patch) | |
tree | bb7589c232ad54bfd037ae016ee0991342ebccfa | |
parent | 9f1470325518a8ee5b6c0c2c1254ab4dccac0f63 (diff) | |
download | manaverse-c6ac11341bd99cbe5eeb4275b9b2473e21338d5e.tar.gz manaverse-c6ac11341bd99cbe5eeb4275b9b2473e21338d5e.tar.bz2 manaverse-c6ac11341bd99cbe5eeb4275b9b2473e21338d5e.tar.xz manaverse-c6ac11341bd99cbe5eeb4275b9b2473e21338d5e.zip |
Fix code style.
-rw-r--r-- | src/actions/actions.cpp | 5 | ||||
-rw-r--r-- | src/being/being.cpp | 7 | ||||
-rw-r--r-- | src/being/localplayer.cpp | 3 | ||||
-rw-r--r-- | src/gui/popups/popupmenu.cpp | 12 | ||||
-rw-r--r-- | src/gui/viewport.cpp | 19 | ||||
-rw-r--r-- | src/net/tmwa/chatrecv.cpp | 6 | ||||
-rw-r--r-- | src/resources/atlas/atlasmanager.cpp | 4 | ||||
-rw-r--r-- | src/resources/mapreader.cpp | 7 |
8 files changed, 45 insertions, 18 deletions
diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp index 176495a18..e9bf8b110 100644 --- a/src/actions/actions.cpp +++ b/src/actions/actions.cpp @@ -896,8 +896,11 @@ impHandler(targetAttack) { target = actorManager->findBeing(fromInt(atoi( args.substr(1).c_str()), BeingId)); - if ((target != nullptr) && target->getType() != ActorType::Monster) + if (target != nullptr && + target->getType() != ActorType::Monster) + { target = nullptr; + } } } diff --git a/src/being/being.cpp b/src/being/being.cpp index 9029b5ae1..fb19b2f61 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -1522,7 +1522,7 @@ void Being::setAction(const BeingActionT &restrict action, } else { - if ((mInfo == nullptr) || (mInfo->getAttack(attackId) == nullptr)) + if (mInfo == nullptr || mInfo->getAttack(attackId) == nullptr) break; currentAction = getAttackAction(mInfo->getAttack(attackId)); @@ -2305,8 +2305,11 @@ void Being::drawSpeech(const int offsetX, // Draw speech above this being if (mSpeechTime == 0) { - if ((mSpeechBubble != nullptr) && mSpeechBubble->mVisible == Visible_true) + if (mSpeechBubble != nullptr && + mSpeechBubble->mVisible == Visible_true) + { mSpeechBubble->setVisible(Visible_false); + } mSpeech.clear(); } else if (mSpeechTime > 0 && (speech == BeingSpeech::NAME_IN_BUBBLE || diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index 061945c0c..c0f4caa80 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -2584,7 +2584,8 @@ void LocalPlayer::setRealPos(const int x, const int y) { const MapItem *const mapItem = layer->getTile(x, y); - if ((mapItem == nullptr) || mapItem->getType() == MapItemType::EMPTY) + if (mapItem == nullptr || + mapItem->getType() == MapItemType::EMPTY) { if (mX != x && mY != y) { diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 8a4392143..0dbcaac2f 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -145,8 +145,12 @@ void PopupMenu::postInit() void PopupMenu::showPopup(const int x, const int y, const Being *const being) { - if ((being == nullptr) || (localPlayer == nullptr) || (actorManager == nullptr)) + if (being == nullptr || + localPlayer == nullptr || + actorManager == nullptr) + { return; + } mBeingId = being->getId(); mName = being->getName(); @@ -830,8 +834,12 @@ void PopupMenu::showSpellPopup(const int x, const int y, void PopupMenu::showChatPopup(const int x, const int y, ChatTab *const tab) { - if ((tab == nullptr) || (actorManager == nullptr) || (localPlayer == nullptr)) + if (tab == nullptr || + actorManager == nullptr || + localPlayer == nullptr) + { return; + } mTab = tab; mX = x; diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 28d66975d..bbd247316 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -454,8 +454,11 @@ bool Viewport::leftMouseAction() actorManager->heal(mHoverBeing); #endif // TMWA_SUPPORT - if (localPlayer == mHoverBeing && (mHoverItem != nullptr)) + if (localPlayer == mHoverBeing && + mHoverItem != nullptr) + { localPlayer->pickUp(mHoverItem); + } return true; } break; @@ -692,8 +695,9 @@ void Viewport::walkByMouse(const MouseEvent &event) int dy = 0; if (x2 > y2) { - if ((y2 != 0) && static_cast<float>(x2) / static_cast<float>(y2) - / wh > diff) + if (y2 != 0 && + static_cast<float>(x2) / static_cast<float>(y2) / + wh > diff) { y = 0; } @@ -911,8 +915,12 @@ void Viewport::optionChanged(const std::string &name) void Viewport::mouseMoved(MouseEvent &event) { // Check if we are on the map - if ((mMap == nullptr) || (localPlayer == nullptr) || (actorManager == nullptr)) + if (mMap == nullptr || + localPlayer == nullptr || + actorManager == nullptr) + { return; + } if (mMouseDirectionMove) mPlayerFollowMouse = false; @@ -954,7 +962,8 @@ void Viewport::mouseMoved(MouseEvent &event) / mMap->getTileHeight(); mHoverSign = specialLayer->getTile(mouseTileX, mouseTileY); - if ((mHoverSign != nullptr) && mHoverSign->getType() != MapItemType::EMPTY) + if (mHoverSign != nullptr && + mHoverSign->getType() != MapItemType::EMPTY) { if (!mHoverSign->getComment().empty()) { diff --git a/src/net/tmwa/chatrecv.cpp b/src/net/tmwa/chatrecv.cpp index 116674c53..0d90a6f99 100644 --- a/src/net/tmwa/chatrecv.cpp +++ b/src/net/tmwa/chatrecv.cpp @@ -251,8 +251,10 @@ void ChatRecv::processWhisperContinue(const std::string &nick, } else { - if ((chatWindow != nullptr) && (showMsg || (chatMsg.find("!selllist") != 0 - && chatMsg.find("!buylist") != 0))) + if (chatWindow != nullptr && + (showMsg || + (chatMsg.find("!selllist") != 0 && + chatMsg.find("!buylist") != 0))) { chatWindow->addWhisper(nick, chatMsg); } diff --git a/src/resources/atlas/atlasmanager.cpp b/src/resources/atlas/atlasmanager.cpp index c2da00732..10bc6136f 100644 --- a/src/resources/atlas/atlasmanager.cpp +++ b/src/resources/atlas/atlasmanager.cpp @@ -152,8 +152,8 @@ void AtlasManager::loadImages(const StringVect &files, if (rw != nullptr) { Image *const image = d != nullptr ? - surfaceImageHelper->load(rw, *d) : - surfaceImageHelper->load(rw); + surfaceImageHelper->load(rw, *d) + : surfaceImageHelper->load(rw); if (image != nullptr) { diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index b795b5e0f..22fcd7bd8 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -564,8 +564,8 @@ inline static void setTile(Map *const map, { case MapLayerType::TILES: { - Image *const img = set != nullptr ? set->get(gid - set->getFirstGid()) - : nullptr; + Image *const img = set != nullptr ? + set->get(gid - set->getFirstGid()) : nullptr; if (layer != nullptr) layer->setTile(x, y, img); break; @@ -1192,7 +1192,8 @@ Tileset *MapReader::readTileset(XmlNodePtr node, } // create animation - if ((set == nullptr) || !config.getBoolValue("playMapAnimations")) + if (set == nullptr || + !config.getBoolValue("playMapAnimations")) { delete ani; continue; |