diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/popups/popupmenu.cpp | 12 | ||||
-rw-r--r-- | src/gui/viewport.cpp | 19 |
2 files changed, 24 insertions, 7 deletions
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()) { |