diff options
Diffstat (limited to 'src/gui/popups')
-rw-r--r-- | src/gui/popups/popupmenu.cpp | 50 | ||||
-rw-r--r-- | src/gui/popups/popupmenu.h | 2 |
2 files changed, 30 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 diff --git a/src/gui/popups/popupmenu.h b/src/gui/popups/popupmenu.h index 83fe8d563..6e229072a 100644 --- a/src/gui/popups/popupmenu.h +++ b/src/gui/popups/popupmenu.h @@ -157,6 +157,8 @@ class PopupMenu final : public Popup, public LinkHandler void addBuySell(const Being *const being); + void addParty(const std::string &nick); + void addPartyName(const std::string &partyName); void addBuySellDefault(); |