diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-02-11 00:01:36 +0100 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2009-02-10 20:19:45 -0700 |
commit | d99b00a149e7828adb3c4651069483e51b0b458b (patch) | |
tree | 33f07f9d18dd006d10b14ff2dffbcbe337809d0c /src/gui/popupmenu.cpp | |
parent | d268447e18c6e3edd80658f8f8d4317740c33af9 (diff) | |
download | mana-client-d99b00a149e7828adb3c4651069483e51b0b458b.tar.gz mana-client-d99b00a149e7828adb3c4651069483e51b0b458b.tar.bz2 mana-client-d99b00a149e7828adb3c4651069483e51b0b458b.tar.xz mana-client-d99b00a149e7828adb3c4651069483e51b0b458b.zip |
Removed many pointless comparisons with NULL
Sometimes it's nice for clarity, but most of the time this is just
clutter. C++ != Java. :)
Diffstat (limited to 'src/gui/popupmenu.cpp')
-rw-r--r-- | src/gui/popupmenu.cpp | 34 |
1 files changed, 10 insertions, 24 deletions
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index d10faa0d..7f82d1b5 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -145,55 +145,42 @@ void PopupMenu::showPopup(int x, int y, FloorItem *floorItem) void PopupMenu::handleLink(const std::string& link) { // Talk To action - if (link == "talk" && - mBeing != NULL && - mBeing->getType() == Being::NPC && + if (link == "talk" && mBeing && mBeing->getType() == Being::NPC && current_npc == 0) { dynamic_cast<NPC*>(mBeing)->talk(); } // Trade action - else if (link == "trade" && - mBeing != NULL && - mBeing->getType() == Being::PLAYER) + else if (link == "trade" && mBeing && mBeing->getType() == Being::PLAYER) { player_node->trade(mBeing); tradePartnerName = mBeing->getName(); } // Attack action - else if (link == "attack" && - mBeing != NULL && - mBeing->getType() == Being::PLAYER) + else if (link == "attack" && mBeing && mBeing->getType() == Being::PLAYER) { player_node->attack(mBeing, true); } - else if (link == "unignore" && - mBeing != NULL && - mBeing->getType() == Being::PLAYER) + else if (link == "unignore" && mBeing && mBeing->getType() == Being::PLAYER) { player_relations.setRelation(mBeing->getName(), PlayerRelation::NEUTRAL); } - else if (link == "ignore" && - mBeing != NULL && - mBeing->getType() == Being::PLAYER) + else if (link == "ignore" && mBeing && mBeing->getType() == Being::PLAYER) { player_relations.setRelation(mBeing->getName(), PlayerRelation::IGNORED); } - else if (link == "disregard" && - mBeing != NULL && + else if (link == "disregard" && mBeing && mBeing->getType() == Being::PLAYER) { player_relations.setRelation(mBeing->getName(), PlayerRelation::DISREGARDED); } - else if (link == "friend" && - mBeing != NULL && - mBeing->getType() == Being::PLAYER) + else if (link == "friend" && mBeing && mBeing->getType() == Being::PLAYER) { player_relations.setRelation(mBeing->getName(), PlayerRelation::FRIEND); } @@ -206,7 +193,7 @@ void PopupMenu::handleLink(const std::string& link) /* // Add Buddy action - else if ((link == "buddy") && mBeing != NULL && mBeing->isPlayer()) + else if ((link == "buddy") && mBeing && mBeing->isPlayer()) { if (!buddyWindow->isVisible()) buddyWindow->setVisible(true); @@ -215,7 +202,7 @@ void PopupMenu::handleLink(const std::string& link) }*/ // Pick Up Floor Item action - else if ((link == "pickup") && mFloorItem != NULL) + else if ((link == "pickup") && mFloorItem) { player_node->pickUp(mFloorItem); } @@ -254,8 +241,7 @@ void PopupMenu::handleLink(const std::string& link) { new ItemAmountWindow(AMOUNT_ITEM_DROP, inventoryWindow, mItem); } - else if (link == "party-invite" && - mBeing != NULL && + else if (link == "party-invite" && mBeing && mBeing->getType() == Being::PLAYER) { MessageOut outMsg(player_node->getNetwork()); |