diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-06-06 23:34:34 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-06-07 19:23:40 +0300 |
commit | 36ba43d6ea38062b17f7e63ef659962bfc51c64d (patch) | |
tree | 190156cb88b13a38a6d13c69ee0742cc078065a1 /src/listeners | |
parent | f1518dd8476c968a43fa57cfb06198e290a4f77a (diff) | |
download | plus-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.gz plus-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.bz2 plus-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.xz plus-36ba43d6ea38062b17f7e63ef659962bfc51c64d.zip |
Fix clang-tidy check readability-implicit-bool-cast.
Diffstat (limited to 'src/listeners')
27 files changed, 44 insertions, 42 deletions
diff --git a/src/listeners/arrowslistener.cpp b/src/listeners/arrowslistener.cpp index fbc86b205..4a9074b74 100644 --- a/src/listeners/arrowslistener.cpp +++ b/src/listeners/arrowslistener.cpp @@ -30,7 +30,7 @@ void ArrowsListener::distributeEvent() it, mListeners) { ArrowsListener *const listener = *it; - if (listener) + if (listener != nullptr) listener->arrowsChanged(); } } diff --git a/src/listeners/attributelistener.cpp b/src/listeners/attributelistener.cpp index 6bf09cdf9..dd6fc145c 100644 --- a/src/listeners/attributelistener.cpp +++ b/src/listeners/attributelistener.cpp @@ -32,7 +32,7 @@ void AttributeListener::distributeEvent(const AttributesT id, it, mListeners) { AttributeListener *const listener = *it; - if (listener) + if (listener != nullptr) listener->attributeChanged(id, oldVal, newVal); } } diff --git a/src/listeners/awaylistener.cpp b/src/listeners/awaylistener.cpp index bdcd6e7ea..3261fe403 100644 --- a/src/listeners/awaylistener.cpp +++ b/src/listeners/awaylistener.cpp @@ -35,11 +35,13 @@ void AwayListener::action(const ActionEvent &event) { - if (event.getId() == "ok" && localPlayer && settings.awayMode) + if (event.getId() == "ok" && + localPlayer != nullptr && + settings.awayMode) { GameModifiers::changeAwayMode(true); localPlayer->updateStatus(); - if (outfitWindow) + if (outfitWindow != nullptr) outfitWindow->unwearAwayOutfit(); UpdateStatusListener::distributeEvent(); } diff --git a/src/listeners/banklistener.cpp b/src/listeners/banklistener.cpp index d175a2235..c308ece27 100644 --- a/src/listeners/banklistener.cpp +++ b/src/listeners/banklistener.cpp @@ -30,7 +30,7 @@ void BankListener::distributeEvent(const int money) it, mListeners) { BankListener *const listener = *it; - if (listener) + if (listener != nullptr) listener->bankMoneyChanged(money); } } diff --git a/src/listeners/buyingstoremodelistener.cpp b/src/listeners/buyingstoremodelistener.cpp index c112be99c..8c17188f5 100644 --- a/src/listeners/buyingstoremodelistener.cpp +++ b/src/listeners/buyingstoremodelistener.cpp @@ -30,7 +30,7 @@ void BuyingStoreModeListener::distributeEvent(const bool b) it, mListeners) { BuyingStoreModeListener *const listener = *it; - if (listener) + if (listener != nullptr) listener->buyingStoreEnabled(b); } } diff --git a/src/listeners/buyingstoreslotslistener.cpp b/src/listeners/buyingstoreslotslistener.cpp index 6155b97fd..e62ee1d4a 100644 --- a/src/listeners/buyingstoreslotslistener.cpp +++ b/src/listeners/buyingstoreslotslistener.cpp @@ -30,7 +30,7 @@ void BuyingStoreSlotsListener::distributeEvent(const int slots) it, mListeners) { BuyingStoreSlotsListener *const listener = *it; - if (listener) + if (listener != nullptr) listener->buyingStoreSlotsChanged(slots); } } diff --git a/src/listeners/charrenamelistener.cpp b/src/listeners/charrenamelistener.cpp index 7d28d9e58..0ac83b39c 100644 --- a/src/listeners/charrenamelistener.cpp +++ b/src/listeners/charrenamelistener.cpp @@ -39,9 +39,9 @@ void CharRenameListener::action(const ActionEvent &event) { if (event.getId() != "OK") return; - if (mDialog) + if (mDialog != nullptr) { - if (charServerHandler) + if (charServerHandler != nullptr) charServerHandler->renameCharacter(mId, mDialog->getMsg()); mDialog = nullptr; } diff --git a/src/listeners/debugmessagelistener.cpp b/src/listeners/debugmessagelistener.cpp index cdc13cb53..92e1709b8 100644 --- a/src/listeners/debugmessagelistener.cpp +++ b/src/listeners/debugmessagelistener.cpp @@ -30,7 +30,7 @@ void DebugMessageListener::distributeEvent(const std::string &msg) it, mListeners) { DebugMessageListener *const listener = *it; - if (listener) + if (listener != nullptr) listener->debugMessage(msg); } } diff --git a/src/listeners/gamemodifierlistener.cpp b/src/listeners/gamemodifierlistener.cpp index 17e63120a..82f7ad5bb 100644 --- a/src/listeners/gamemodifierlistener.cpp +++ b/src/listeners/gamemodifierlistener.cpp @@ -30,7 +30,7 @@ void GameModifierListener::distributeEvent() it, mListeners) { GameModifierListener *const listener = *it; - if (listener) + if (listener != nullptr) listener->gameModifiersChanged(); } } diff --git a/src/listeners/guiconfiglistener.h b/src/listeners/guiconfiglistener.h index e8e7ab39c..9d0788b38 100644 --- a/src/listeners/guiconfiglistener.h +++ b/src/listeners/guiconfiglistener.h @@ -47,7 +47,7 @@ class GuiConfigListener final : public ConfigListener void optionChanged(const std::string &name) override final { - if (!mGui) + if (mGui == nullptr) return; if (name == "customcursor") mGui->setUseCustomCursor(config.getBoolValue("customcursor")); diff --git a/src/listeners/guitableactionlistener.cpp b/src/listeners/guitableactionlistener.cpp index fab11d509..2abcaaf6e 100644 --- a/src/listeners/guitableactionlistener.cpp +++ b/src/listeners/guitableactionlistener.cpp @@ -36,7 +36,7 @@ GuiTableActionListener::GuiTableActionListener(GuiTable *const restrict table, mColumn(column), mWidget(widget) { - if (widget && table) + if ((widget != nullptr) && (table != nullptr)) { widget->addActionListener(this); widget->setParent(table); @@ -46,7 +46,7 @@ GuiTableActionListener::GuiTableActionListener(GuiTable *const restrict table, GuiTableActionListener::~GuiTableActionListener() { - if (mWidget) + if (mWidget != nullptr) { mWidget->removeActionListener(this); mWidget->setWindow(nullptr); @@ -56,7 +56,7 @@ GuiTableActionListener::~GuiTableActionListener() void GuiTableActionListener::action(const ActionEvent &actionEvent A_UNUSED) { - if (mTable) + if (mTable != nullptr) { mTable->setSelected(mRow, mColumn); mTable->distributeActionEvent(); diff --git a/src/listeners/inputactionreplaylistener.cpp b/src/listeners/inputactionreplaylistener.cpp index 0e1a7d7fb..8efa2bb19 100644 --- a/src/listeners/inputactionreplaylistener.cpp +++ b/src/listeners/inputactionreplaylistener.cpp @@ -55,7 +55,7 @@ void InputActionReplayListener::action(const ActionEvent &event) mAction = InputAction::NO_VALUE; return; } - if (mDialog) + if (mDialog != nullptr) { inputManager.executeChatCommand(mAction, mDialog->getMsg(), diff --git a/src/listeners/insertcardlistener.h b/src/listeners/insertcardlistener.h index 4c9ba0857..db963332a 100644 --- a/src/listeners/insertcardlistener.h +++ b/src/listeners/insertcardlistener.h @@ -43,7 +43,7 @@ struct InsertCardListener final : public ActionListener public: void action(const ActionEvent &event) override final { - if (event.getId() == "yes" && inventoryHandler) + if (event.getId() == "yes" && (inventoryHandler != nullptr)) inventoryHandler->insertCard(cardIndex, itemIndex); } diff --git a/src/listeners/pincodelistener.cpp b/src/listeners/pincodelistener.cpp index dad76d2e0..5b3c757d1 100644 --- a/src/listeners/pincodelistener.cpp +++ b/src/listeners/pincodelistener.cpp @@ -32,7 +32,7 @@ void PincodeListener::action(const ActionEvent &event) { const EditDialog *const dialog = dynamic_cast<EditDialog*>( event.getSource()); - if (dialog) + if (dialog != nullptr) { const std::string pincode = dialog->getMsg(); charServerHandler->setNewPincode(pincode); diff --git a/src/listeners/playerdeathlistener.cpp b/src/listeners/playerdeathlistener.cpp index d70565ec1..2b0b86c77 100644 --- a/src/listeners/playerdeathlistener.cpp +++ b/src/listeners/playerdeathlistener.cpp @@ -30,7 +30,7 @@ void PlayerDeathListener::distributeEvent() it, mListeners) { PlayerDeathListener *const listener = *it; - if (listener) + if (listener != nullptr) listener->playerDeath(); } } diff --git a/src/listeners/playerlistener.cpp b/src/listeners/playerlistener.cpp index dbf5c3d32..62a749b6e 100644 --- a/src/listeners/playerlistener.cpp +++ b/src/listeners/playerlistener.cpp @@ -38,12 +38,12 @@ PlayerListener::PlayerListener() : void PlayerListener::action(const ActionEvent &event) { - if (event.getId() == "ok" && !mNick.empty() && mDialog) + if (event.getId() == "ok" && !mNick.empty() && (mDialog != nullptr)) { std::string comment = mDialog->getText(); Being *const being = actorManager->findBeingByName( mNick, static_cast<ActorTypeT>(mType)); - if (being) + if (being != nullptr) being->setComment(comment); Being::saveComment(mNick, comment, mType); } diff --git a/src/listeners/playerpostdeathlistener.h b/src/listeners/playerpostdeathlistener.h index dc7128422..c938ea175 100644 --- a/src/listeners/playerpostdeathlistener.h +++ b/src/listeners/playerpostdeathlistener.h @@ -49,17 +49,17 @@ struct PlayerPostDeathListener final : public ActionListener void action(const ActionEvent &event A_UNUSED) override final { - if (playerHandler) + if (playerHandler != nullptr) playerHandler->respawn(); deathNotice = nullptr; DialogsManager::closeDialogs(); - if (popupManager) + if (popupManager != nullptr) popupManager->closePopupMenu(); NpcDialog::clearDialogs(); - if (localPlayer) + if (localPlayer != nullptr) localPlayer->respawn(); } }; diff --git a/src/listeners/renamelistener.cpp b/src/listeners/renamelistener.cpp index f092f0369..b8bc19883 100644 --- a/src/listeners/renamelistener.cpp +++ b/src/listeners/renamelistener.cpp @@ -41,7 +41,7 @@ RenameListener::RenameListener() : void RenameListener::setMapItem(const MapItem *const mapItem) { - if (mapItem) + if (mapItem != nullptr) { mMapItemX = mapItem->getX(); mMapItemY = mapItem->getY(); @@ -55,25 +55,25 @@ void RenameListener::setMapItem(const MapItem *const mapItem) void RenameListener::action(const ActionEvent &event) { - if (event.getId() == "ok" && viewport && mDialog) + if (event.getId() == "ok" && (viewport != nullptr) && (mDialog != nullptr)) { const Map *const map = viewport->getMap(); - if (!map) + if (map == nullptr) return; const SpecialLayer *const sl = map->getSpecialLayer(); MapItem *item = nullptr; - if (sl) + if (sl != nullptr) { item = sl->getTile(mMapItemX, mMapItemY); - if (item) + if (item != nullptr) item->setComment(mDialog->getText()); } item = map->findPortalXY(mMapItemX, mMapItemY); - if (item) + if (item != nullptr) item->setComment(mDialog->getText()); - if (socialWindow) + if (socialWindow != nullptr) socialWindow->updatePortalNames(); } mDialog = nullptr; diff --git a/src/listeners/shoprenamelistener.cpp b/src/listeners/shoprenamelistener.cpp index ea5610b51..60ca7945e 100644 --- a/src/listeners/shoprenamelistener.cpp +++ b/src/listeners/shoprenamelistener.cpp @@ -37,7 +37,7 @@ void ShopRenameListener::action(const ActionEvent &event) { if (event.getId() != "OK") return; - if (mDialog) + if (mDialog != nullptr) { shopWindow->setShopName(mDialog->getMsg()); mDialog = nullptr; diff --git a/src/listeners/skillwarplistener.cpp b/src/listeners/skillwarplistener.cpp index d148496a8..d8f66f9a8 100644 --- a/src/listeners/skillwarplistener.cpp +++ b/src/listeners/skillwarplistener.cpp @@ -39,7 +39,7 @@ void SkillWarpListener::action(const ActionEvent &event) { if (event.getId() != "OK") return; - if (mDialog && skillHandler) + if ((mDialog != nullptr) && (skillHandler != nullptr)) { skillHandler->useMap(mSkillId, mDialog->getText()); diff --git a/src/listeners/statlistener.cpp b/src/listeners/statlistener.cpp index 1de6c328e..577ba0cc8 100644 --- a/src/listeners/statlistener.cpp +++ b/src/listeners/statlistener.cpp @@ -32,7 +32,7 @@ void StatListener::distributeEvent(const AttributesT id, it, mListeners) { StatListener *const listener = *it; - if (listener) + if (listener != nullptr) listener->statChanged(id, oldVal1, oldVal2); } } diff --git a/src/listeners/textskilllistener.cpp b/src/listeners/textskilllistener.cpp index 94d3d9186..1c0434948 100644 --- a/src/listeners/textskilllistener.cpp +++ b/src/listeners/textskilllistener.cpp @@ -49,7 +49,7 @@ void TextSkillListener::setSkill(const int skillId, void TextSkillListener::action(const ActionEvent &event) { - if (event.getId() == "ok" && mDialog) + if (event.getId() == "ok" && (mDialog != nullptr)) { const std::string text = mDialog->getText(); if (text.empty()) diff --git a/src/listeners/tooltiplistener.cpp b/src/listeners/tooltiplistener.cpp index f17af37f4..665839abf 100644 --- a/src/listeners/tooltiplistener.cpp +++ b/src/listeners/tooltiplistener.cpp @@ -35,12 +35,12 @@ ToolTipListener::ToolTipListener() : void ToolTipListener::mouseMoved(MouseEvent &event) { - if (mToolTip.empty() || !textBoxPopup) + if (mToolTip.empty() || (textBoxPopup == nullptr)) return; int x = 0; int y = 0; - if (viewport) + if (viewport != nullptr) { x = viewport->mMouseX; y = viewport->mMouseY; @@ -56,7 +56,7 @@ void ToolTipListener::mouseMoved(MouseEvent &event) void ToolTipListener::mouseExited(MouseEvent &event A_UNUSED) { - if (mToolTip.empty() || !textBoxPopup) + if (mToolTip.empty() || (textBoxPopup == nullptr)) return; textBoxPopup->hide(); } diff --git a/src/listeners/updatestatuslistener.cpp b/src/listeners/updatestatuslistener.cpp index 1b55cbfc3..e1a819e23 100644 --- a/src/listeners/updatestatuslistener.cpp +++ b/src/listeners/updatestatuslistener.cpp @@ -30,7 +30,7 @@ void UpdateStatusListener::distributeEvent() it, mListeners) { UpdateStatusListener *const listener = *it; - if (listener) + if (listener != nullptr) listener->updateStatus(); } } diff --git a/src/listeners/vendingmodelistener.cpp b/src/listeners/vendingmodelistener.cpp index 9ccb8b745..b0bd687f8 100644 --- a/src/listeners/vendingmodelistener.cpp +++ b/src/listeners/vendingmodelistener.cpp @@ -30,7 +30,7 @@ void VendingModeListener::distributeEvent(const bool b) it, mListeners) { VendingModeListener *const listener = *it; - if (listener) + if (listener != nullptr) listener->vendingEnabled(b); } } diff --git a/src/listeners/vendingslotslistener.cpp b/src/listeners/vendingslotslistener.cpp index 46a5e76c8..c89c865b4 100644 --- a/src/listeners/vendingslotslistener.cpp +++ b/src/listeners/vendingslotslistener.cpp @@ -30,7 +30,7 @@ void VendingSlotsListener::distributeEvent(const int slots) it, mListeners) { VendingSlotsListener *const listener = *it; - if (listener) + if (listener != nullptr) listener->vendingSlotsChanged(slots); } } diff --git a/src/listeners/wrongdatanoticelistener.cpp b/src/listeners/wrongdatanoticelistener.cpp index 2e373b30b..ea227eca7 100644 --- a/src/listeners/wrongdatanoticelistener.cpp +++ b/src/listeners/wrongdatanoticelistener.cpp @@ -39,6 +39,6 @@ void WrongDataNoticeListener::setTarget(TextField *const textField) void WrongDataNoticeListener::action(const ActionEvent &event) { - if (event.getId() == "ok" && mTarget) + if (event.getId() == "ok" && (mTarget != nullptr)) mTarget->requestFocus(); } |