summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-10 18:33:32 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-10 18:33:32 +0300
commit041d2bcfc1d66090f2f5c21db03eaafca35add46 (patch)
tree998aea9a18f55f330b1ecbd8389ae0d736aeb286 /src/gui
parentab07e8d1c5525d9bcbd3669a874d061cbc0236da (diff)
downloadmanaverse-041d2bcfc1d66090f2f5c21db03eaafca35add46.tar.gz
manaverse-041d2bcfc1d66090f2f5c21db03eaafca35add46.tar.bz2
manaverse-041d2bcfc1d66090f2f5c21db03eaafca35add46.tar.xz
manaverse-041d2bcfc1d66090f2f5c21db03eaafca35add46.zip
In server features add havePartyNickInvite.
Allow invite in party by nick if server support havePartyNickInvite.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/popups/popupmenu.cpp50
-rw-r--r--src/gui/popups/popupmenu.h2
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();