summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-16 17:30:42 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-16 17:30:42 +0300
commit72cc15bc148acc2484a2be3b6e7da322735aca95 (patch)
treeebb4c781ab7e95a941a1cf2c3265754a1d088b84
parent4d54d36ed8e4bcc34e5b9f90e2126fadb490c34f (diff)
downloadplus-72cc15bc148acc2484a2be3b6e7da322735aca95.tar.gz
plus-72cc15bc148acc2484a2be3b6e7da322735aca95.tar.bz2
plus-72cc15bc148acc2484a2be3b6e7da322735aca95.tar.xz
plus-72cc15bc148acc2484a2be3b6e7da322735aca95.zip
add server feature haveNativeGuilds.
-rw-r--r--src/actions/chat.cpp5
-rw-r--r--src/actions/commands.cpp8
-rw-r--r--src/gui/windows/socialwindow.cpp5
-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/guildhandler.cpp5
-rw-r--r--src/net/tmwa/serverfeatures.cpp5
-rw-r--r--src/net/tmwa/serverfeatures.h2
-rw-r--r--src/utils/chatutils.cpp3
10 files changed, 35 insertions, 7 deletions
diff --git a/src/actions/chat.cpp b/src/actions/chat.cpp
index c10a48fa3..a164e0f23 100644
--- a/src/actions/chat.cpp
+++ b/src/actions/chat.cpp
@@ -37,6 +37,7 @@
#include "net/guildhandler.h"
#include "net/net.h"
#include "net/partyhandler.h"
+#include "net/serverfeatures.h"
#include "utils/booleanoptions.h"
#include "utils/gettext.h"
@@ -74,7 +75,7 @@ static void outString(const ChatTab *const tab,
{
if (guild->getServerGuild())
{
- if (tmwServerVersion > 0)
+ if (!Net::getServerFeatures()->haveNativeGuilds())
return;
Net::getGuildHandler()->chat(guild->getId(), str);
}
@@ -273,7 +274,7 @@ impHandler(createParty)
impHandler(createGuild)
{
- if (!event.tab || tmwServerVersion > 0)
+ if (!event.tab || !Net::getServerFeatures()->haveNativeGuilds())
return false;
if (event.args.empty())
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp
index 692837ce6..c8829970f 100644
--- a/src/actions/commands.cpp
+++ b/src/actions/commands.cpp
@@ -40,8 +40,9 @@
#include "net/adminhandler.h"
#include "net/chathandler.h"
#include "net/guildhandler.h"
-#include "net/pethandler.h"
#include "net/net.h"
+#include "net/pethandler.h"
+#include "net/serverfeatures.h"
#include "utils/chatutils.h"
#include "utils/gettext.h"
@@ -411,8 +412,11 @@ impHandler(sendMail)
impHandler(info)
{
- if (!event.tab || !localPlayer || tmwServerVersion > 0)
+ if (!event.tab || !localPlayer
+ || !Net::getServerFeatures()->haveNativeGuilds())
+ {
return false;
+ }
switch (event.tab->getType())
{
diff --git a/src/gui/windows/socialwindow.cpp b/src/gui/windows/socialwindow.cpp
index be5cbea11..5a8931524 100644
--- a/src/gui/windows/socialwindow.cpp
+++ b/src/gui/windows/socialwindow.cpp
@@ -52,6 +52,9 @@
#include "gui/popups/createpartypopup.h"
+#include "net/net.h"
+#include "net/serverfeatures.h"
+
#include "debug.h"
SocialWindow *socialWindow = nullptr;
@@ -342,7 +345,7 @@ void SocialWindow::action(const ActionEvent &event)
}
else if (eventId == "create guild")
{
- if (tmwServerVersion > 0)
+ if (!Net::getServerFeatures()->haveNativeGuilds())
return;
std::string name = mGuildCreateDialog->getText();
diff --git a/src/net/eathena/serverfeatures.cpp b/src/net/eathena/serverfeatures.cpp
index f724d663a..1e055191b 100644
--- a/src/net/eathena/serverfeatures.cpp
+++ b/src/net/eathena/serverfeatures.cpp
@@ -67,4 +67,9 @@ bool ServerFeatures::haveBrokenPlayerAttackDistance() const
return false;
}
+bool ServerFeatures::haveNativeGuilds() const
+{
+ return true;
+}
+
} // namespace EAthena
diff --git a/src/net/eathena/serverfeatures.h b/src/net/eathena/serverfeatures.h
index fcd4cc97a..6ca4df652 100644
--- a/src/net/eathena/serverfeatures.h
+++ b/src/net/eathena/serverfeatures.h
@@ -47,6 +47,8 @@ class ServerFeatures final : public Net::ServerFeatures
bool havePlayerStatusUpdate() const override final;
bool haveBrokenPlayerAttackDistance() const override final;
+
+ bool haveNativeGuilds() const override final;
};
} // namespace EAthena
diff --git a/src/net/serverfeatures.h b/src/net/serverfeatures.h
index b3407d2b0..b90df0796 100644
--- a/src/net/serverfeatures.h
+++ b/src/net/serverfeatures.h
@@ -44,6 +44,8 @@ class ServerFeatures notfinal
virtual bool havePlayerStatusUpdate() const = 0;
virtual bool haveBrokenPlayerAttackDistance() const = 0;
+
+ virtual bool haveNativeGuilds() const = 0;
};
} // namespace Net
diff --git a/src/net/tmwa/guildhandler.cpp b/src/net/tmwa/guildhandler.cpp
index 852dfa135..8947c7c32 100644
--- a/src/net/tmwa/guildhandler.cpp
+++ b/src/net/tmwa/guildhandler.cpp
@@ -26,6 +26,9 @@
#include "being/localplayer.h"
#include "being/playerinfo.h"
+#include "net/net.h"
+#include "net/serverfeatures.h"
+
#include "net/tmwa/messageout.h"
#include "net/tmwa/protocol.h"
@@ -83,7 +86,7 @@ GuildHandler::~GuildHandler()
void GuildHandler::handleMessage(Net::MessageIn &msg)
{
BLOCK_START("GuildHandler::handleMessage")
- if (tmwServerVersion > 0)
+ if (!Net::getServerFeatures()->haveNativeGuilds())
return;
switch (msg.getId())
diff --git a/src/net/tmwa/serverfeatures.cpp b/src/net/tmwa/serverfeatures.cpp
index 86f679ae9..498d19249 100644
--- a/src/net/tmwa/serverfeatures.cpp
+++ b/src/net/tmwa/serverfeatures.cpp
@@ -69,4 +69,9 @@ bool ServerFeatures::haveBrokenPlayerAttackDistance() const
return serverVersion < 1;
}
+bool ServerFeatures::haveNativeGuilds() const
+{
+ return tmwServerVersion <= 0;
+}
+
} // namespace TmwAthena
diff --git a/src/net/tmwa/serverfeatures.h b/src/net/tmwa/serverfeatures.h
index 8bf7288b3..3aba539dd 100644
--- a/src/net/tmwa/serverfeatures.h
+++ b/src/net/tmwa/serverfeatures.h
@@ -47,6 +47,8 @@ class ServerFeatures final : public Net::ServerFeatures
bool havePlayerStatusUpdate() const override final;
bool haveBrokenPlayerAttackDistance() const override final;
+
+ bool haveNativeGuilds() const override final;
};
} // namespace TmwAthena
diff --git a/src/utils/chatutils.cpp b/src/utils/chatutils.cpp
index f3c9076be..ee1c8bfc5 100644
--- a/src/utils/chatutils.cpp
+++ b/src/utils/chatutils.cpp
@@ -35,6 +35,7 @@
#include "net/guildhandler.h"
#include "net/net.h"
#include "net/partyhandler.h"
+#include "net/serverfeatures.h"
#include "debug.h"
@@ -67,7 +68,7 @@ void outStringNormal(ChatTab *const tab,
{
if (guild->getServerGuild())
{
- if (tmwServerVersion > 0)
+ if (!Net::getServerFeatures()->haveNativeGuilds())
return;
Net::getGuildHandler()->chat(guild->getId(), str);
}