diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-09-10 18:33:32 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-09-10 18:33:32 +0300 |
commit | 041d2bcfc1d66090f2f5c21db03eaafca35add46 (patch) | |
tree | 998aea9a18f55f330b1ecbd8389ae0d736aeb286 /src/gui/popups/popupmenu.cpp | |
parent | ab07e8d1c5525d9bcbd3669a874d061cbc0236da (diff) | |
download | mv-041d2bcfc1d66090f2f5c21db03eaafca35add46.tar.gz mv-041d2bcfc1d66090f2f5c21db03eaafca35add46.tar.bz2 mv-041d2bcfc1d66090f2f5c21db03eaafca35add46.tar.xz mv-041d2bcfc1d66090f2f5c21db03eaafca35add46.zip |
In server features add havePartyNickInvite.
Allow invite in party by nick if server support havePartyNickInvite.
Diffstat (limited to 'src/gui/popups/popupmenu.cpp')
-rw-r--r-- | src/gui/popups/popupmenu.cpp | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index ed3d82dde..cc73cbc59 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -73,6 +73,7 @@ #include "net/net.h" #include "net/npchandler.h" #include "net/partyhandler.h" +#include "net/serverfeatures.h" #include "net/tradehandler.h" #include "resources/iteminfo.h" @@ -732,28 +733,7 @@ void PopupMenu::showChatPopup(const int x, const int y, ChatTab *const tab) addPlayerMisc(); addBuySell(being); mBrowserBox->addRow("##3---"); - - if (localPlayer->isInParty()) - { - const Party *const party = localPlayer->getParty(); - if (party) - { - if (!party->isMember(wTab->getNick())) - { - // TRANSLATORS: popup menu item - // TRANSLATORS: invite player to party - mBrowserBox->addRow("party", _("Invite to party")); - } - else - { - // TRANSLATORS: popup menu item - // TRANSLATORS: kick player from party - mBrowserBox->addRow("kick party", - _("Kick from party")); - } - mBrowserBox->addRow("##3---"); - } - } + addParty(wTab->getNick()); const Guild *const guild1 = being->getGuild(); const Guild *const guild2 = localPlayer->getGuild(); if (guild2) @@ -815,6 +795,8 @@ void PopupMenu::showChatPopup(const int x, const int y, ChatTab *const tab) } addPlayerMisc(); addBuySellDefault(); + if (Net::getServerFeatures()->havePartyNickInvite()) + addParty(wTab->getNick()); mBrowserBox->addRow("##3---"); } } @@ -2727,6 +2709,30 @@ void PopupMenu::addPartyName(const std::string &partyName) } } +void PopupMenu::addParty(const std::string &nick) +{ + if (localPlayer->isInParty()) + { + const Party *const party = localPlayer->getParty(); + if (party) + { + if (!party->isMember(nick)) + { + // TRANSLATORS: popup menu item + // TRANSLATORS: invite player to party + mBrowserBox->addRow("party", _("Invite to party")); + } + else + { + // TRANSLATORS: popup menu item + // TRANSLATORS: kick player from party + mBrowserBox->addRow("kick party", _("Kick from party")); + } + mBrowserBox->addRow("##3---"); + } + } +} + void PopupMenu::addPlayerMisc() { // TRANSLATORS: popup menu item |