summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/popups/popupmenu.cpp50
-rw-r--r--src/gui/popups/popupmenu.h2
-rw-r--r--src/net/eathena/serverfeatures.cpp5
-rw-r--r--src/net/eathena/serverfeatures.h2
-rw-r--r--src/net/serverfeatures.h2
-rw-r--r--src/net/tmwa/serverfeatures.cpp5
-rw-r--r--src/net/tmwa/serverfeatures.h2
7 files changed, 46 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();
diff --git a/src/net/eathena/serverfeatures.cpp b/src/net/eathena/serverfeatures.cpp
index cb0b730e4..5d5a6d588 100644
--- a/src/net/eathena/serverfeatures.cpp
+++ b/src/net/eathena/serverfeatures.cpp
@@ -37,4 +37,9 @@ bool ServerFeatures::haveOnlineList() const
return false;
}
+bool ServerFeatures::havePartyNickInvite() const
+{
+ return true;
+}
+
} // EAthena
diff --git a/src/net/eathena/serverfeatures.h b/src/net/eathena/serverfeatures.h
index c15bbb705..9bc856f1e 100644
--- a/src/net/eathena/serverfeatures.h
+++ b/src/net/eathena/serverfeatures.h
@@ -35,6 +35,8 @@ class ServerFeatures final : public Net::ServerFeatures
A_DELETE_COPY(ServerFeatures)
bool haveOnlineList() const override final;
+
+ bool havePartyNickInvite() const override final;
};
} // namespace Net
diff --git a/src/net/serverfeatures.h b/src/net/serverfeatures.h
index a2170c44b..3f3268c3a 100644
--- a/src/net/serverfeatures.h
+++ b/src/net/serverfeatures.h
@@ -32,6 +32,8 @@ class ServerFeatures notfinal
{ }
virtual bool haveOnlineList() const = 0;
+
+ virtual bool havePartyNickInvite() const = 0;
};
} // namespace Net
diff --git a/src/net/tmwa/serverfeatures.cpp b/src/net/tmwa/serverfeatures.cpp
index 4942912a5..c8c497613 100644
--- a/src/net/tmwa/serverfeatures.cpp
+++ b/src/net/tmwa/serverfeatures.cpp
@@ -38,4 +38,9 @@ bool ServerFeatures::haveOnlineList() const
return serverVersion >= 3;
}
+bool ServerFeatures::havePartyNickInvite() const
+{
+ return false;
+}
+
} // TmwAthena
diff --git a/src/net/tmwa/serverfeatures.h b/src/net/tmwa/serverfeatures.h
index 6b85b887c..2c846a6ce 100644
--- a/src/net/tmwa/serverfeatures.h
+++ b/src/net/tmwa/serverfeatures.h
@@ -35,6 +35,8 @@ class ServerFeatures final : public Net::ServerFeatures
A_DELETE_COPY(ServerFeatures)
bool haveOnlineList() const override final;
+
+ bool havePartyNickInvite() const override final;
};
} // namespace Net