diff options
author | Jared Adams <jaxad0127@gmail.com> | 2010-03-25 23:45:27 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2010-03-26 06:53:05 -0600 |
commit | 3be9cace41bcef4b7bf55bffea5d3596bd588e7e (patch) | |
tree | 174cb77c11ddf755eaea52bba836b496d177ff91 /src/gui/popupmenu.cpp | |
parent | 48754058d7be3f433734cb1524e9e74cfd4fd55f (diff) | |
download | mana-3be9cace41bcef4b7bf55bffea5d3596bd588e7e.tar.gz mana-3be9cace41bcef4b7bf55bffea5d3596bd588e7e.tar.bz2 mana-3be9cace41bcef4b7bf55bffea5d3596bd588e7e.tar.xz mana-3be9cace41bcef4b7bf55bffea5d3596bd588e7e.zip |
Replace most dynamic_casts with static_casts
The remaining instances can't easily or safely be changed as the classes
involved don't have type information like Being does.
Reviewed-by: Freeyorp
Diffstat (limited to 'src/gui/popupmenu.cpp')
-rw-r--r-- | src/gui/popupmenu.cpp | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index 8404fad1..520b4005 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -203,16 +203,13 @@ void PopupMenu::handleLink(const std::string &link) Being *being = beingManager->findBeing(mBeingId); // Talk To action - if (link == "talk" && - being && being->getType() == Being::NPC) + if (link == "talk" && being && being->getType() == Being::NPC) { - dynamic_cast<NPC*>(being)->talk(); + static_cast<NPC*>(being)->talk(); } // Trade action - else if (link == "trade" && - being && - being->getType() == Being::PLAYER) + else if (link == "trade" && being && being->getType() == Being::PLAYER) { Net::getTradeHandler()->request(being); tradePartnerName = being->getName(); @@ -226,37 +223,27 @@ void PopupMenu::handleLink(const std::string &link) { chatWindow->addInputText("/w \"" + being->getName() + "\" "); } - else if (link == "unignore" && - being && - being->getType() == Being::PLAYER) + else if (link == "unignore" && being && being->getType() == Being::PLAYER) { player_relations.setRelation(being->getName(), PlayerRelation::NEUTRAL); } - else if (link == "ignore" && - being && - being->getType() == Being::PLAYER) + else if (link == "ignore" && being && being->getType() == Being::PLAYER) { player_relations.setRelation(being->getName(), PlayerRelation::IGNORED); } - else if (link == "disregard" && - being && - being->getType() == Being::PLAYER) + else if (link == "disregard" && being && being->getType() == Being::PLAYER) { player_relations.setRelation(being->getName(), PlayerRelation::DISREGARDED); } - else if (link == "friend" && - being && - being->getType() == Being::PLAYER) + else if (link == "friend" && being && being->getType() == Being::PLAYER) { player_relations.setRelation(being->getName(), PlayerRelation::FRIEND); } // Guild action - else if (link == "guild" && - being != NULL && - being->getType() == Being::PLAYER) + else if (link == "guild" && being && being->getType() == Being::PLAYER) { player_node->inviteToGuild(being); } @@ -325,7 +312,7 @@ void PopupMenu::handleLink(const std::string &link) else if (link == "party" && being && being->getType() == Being::PLAYER) { - Net::getPartyHandler()->invite(dynamic_cast<Player*>(being)); + Net::getPartyHandler()->invite(static_cast<Player*>(being)); } else if (link == "name" && being) |