summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/actions/chat.cpp15
-rw-r--r--src/actions/commands.cpp3
-rw-r--r--src/gui/popups/popupmenu.cpp2
-rw-r--r--src/gui/widgets/tabs/chat/chattab.cpp3
-rw-r--r--src/gui/windows/chatwindow.cpp8
-rw-r--r--src/net/eathena/serverfeatures.cpp10
-rw-r--r--src/net/eathena/serverfeatures.h4
-rw-r--r--src/net/serverfeatures.h4
-rw-r--r--src/net/tmwa/guildmanager.cpp23
-rw-r--r--src/net/tmwa/serverfeatures.cpp10
-rw-r--r--src/net/tmwa/serverfeatures.h4
-rw-r--r--src/utils/chatutils.cpp9
12 files changed, 32 insertions, 63 deletions
diff --git a/src/actions/chat.cpp b/src/actions/chat.cpp
index 4da242569..0ea63a507 100644
--- a/src/actions/chat.cpp
+++ b/src/actions/chat.cpp
@@ -35,6 +35,7 @@
#include "net/charserverhandler.h"
#include "net/chathandler.h"
#include "net/guildhandler.h"
+#include "net/net.h"
#include "net/partyhandler.h"
#include "net/serverfeatures.h"
@@ -84,20 +85,21 @@ static void outString(ChatTab *const tab,
const Guild *const guild = localPlayer->getGuild();
if (guild)
{
+#ifdef TMWA_SUPPORT
if (guild->getServerGuild())
{
- if (!serverFeatures ||
- !serverFeatures->haveNativeGuilds())
- {
+ if (Net::getNetworkType() == ServerType::TMWATHENA)
return;
- }
guildHandler->chat(str);
}
-#ifdef TMWA_SUPPORT
else if (guildManager)
{
guildManager->chat(str);
}
+#else // TMWA_SUPPORT
+
+ if (guild->getServerGuild())
+ guildHandler->chat(str);
#endif // TMWA_SUPPORT
}
break;
@@ -355,8 +357,7 @@ impHandler(createParty)
impHandler(createGuild)
{
if (!guildHandler ||
- !serverFeatures ||
- !serverFeatures->haveNativeGuilds())
+ Net::getNetworkType() == ServerType::TMWATHENA)
{
return false;
}
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp
index c7633972b..35fd376cc 100644
--- a/src/actions/commands.cpp
+++ b/src/actions/commands.cpp
@@ -569,8 +569,7 @@ impHandler(info)
{
if (!event.tab ||
!localPlayer ||
- !serverFeatures ||
- !serverFeatures->haveNativeGuilds())
+ Net::getNetworkType() == ServerType::TMWATHENA)
{
return false;
}
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index 450dcee1d..370700f48 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -3430,7 +3430,7 @@ void PopupMenu::addSocialMenu()
mBrowserBox->addRow("/createparty", _("Create party"));
}
- if (serverFeatures->haveNativeGuilds())
+ if (Net::getNetworkType() == ServerType::EATHENA)
{
const Guild *const guild = localPlayer->getGuild();
if (guild)
diff --git a/src/gui/widgets/tabs/chat/chattab.cpp b/src/gui/widgets/tabs/chat/chattab.cpp
index 0a8d38355..9010d1406 100644
--- a/src/gui/widgets/tabs/chat/chattab.cpp
+++ b/src/gui/widgets/tabs/chat/chattab.cpp
@@ -44,6 +44,7 @@
#include "input/inputmanager.h"
#include "net/chathandler.h"
+#include "net/net.h"
#include "net/serverfeatures.h"
#include "utils/chatutils.h"
@@ -224,7 +225,7 @@ void ChatTab::chatLog(std::string line,
}
// if configured, move magic messages log to debug chat tab
- if (!serverFeatures->haveChatChannels()
+ if (Net::getNetworkType() == ServerType::TMWATHENA
&& localChatTab && this == localChatTab
&& ((config.getBoolValue("showMagicInDebug")
&& own == ChatMsgType::BY_PLAYER
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp
index 6e4cb591e..da4a256a1 100644
--- a/src/gui/windows/chatwindow.cpp
+++ b/src/gui/windows/chatwindow.cpp
@@ -71,6 +71,7 @@
#include "resources/db/textdb.h"
#include "net/chathandler.h"
+#include "net/net.h"
#include "net/serverfeatures.h"
#include "utils/copynpaste.h"
@@ -1299,8 +1300,9 @@ ChatTab *ChatWindow::addChatTab(const std::string &name,
const bool switchTo,
const bool join)
{
- if (serverFeatures->haveChatChannels() && name.size() > 1
- && name[0] == '#')
+ if (Net::getNetworkType() == ServerType::EATHENA &&
+ name.size() > 1 &&
+ name[0] == '#')
{
ChatTab *const tab = addChannelTab(name, switchTo);
if (tab && join)
@@ -1696,7 +1698,7 @@ bool ChatWindow::resortChatLog(std::string line,
tryRemoveColors);
}
}
- else if (serverFeatures->haveChatChannels())
+ else if (Net::getNetworkType() == ServerType::EATHENA)
{
channelChatLog(channel, line, own, ignoreRecord, tryRemoveColors);
return false;
diff --git a/src/net/eathena/serverfeatures.cpp b/src/net/eathena/serverfeatures.cpp
index edd4498f9..95bdc764e 100644
--- a/src/net/eathena/serverfeatures.cpp
+++ b/src/net/eathena/serverfeatures.cpp
@@ -51,11 +51,6 @@ bool ServerFeatures::havePlayerStatusUpdate() const
return serverVersion > 0;
}
-bool ServerFeatures::haveNativeGuilds() const
-{
- return true;
-}
-
bool ServerFeatures::haveIncompleteChatMessages() const
{
return false;
@@ -71,11 +66,6 @@ bool ServerFeatures::haveLookSelection() const
return serverVersion > 0;
}
-bool ServerFeatures::haveChatChannels() const
-{
- return true;
-}
-
bool ServerFeatures::haveServerIgnore() const
{
return true;
diff --git a/src/net/eathena/serverfeatures.h b/src/net/eathena/serverfeatures.h
index 91d59345d..21725dfc5 100644
--- a/src/net/eathena/serverfeatures.h
+++ b/src/net/eathena/serverfeatures.h
@@ -40,16 +40,12 @@ class ServerFeatures final : public Net::ServerFeatures
bool havePlayerStatusUpdate() const override final;
- bool haveNativeGuilds() const override final A_CONST;
-
bool haveIncompleteChatMessages() const override final A_CONST;
bool haveRaceSelection() const override final;
bool haveLookSelection() const override final;
- bool haveChatChannels() const override final A_CONST;
-
bool haveServerIgnore() const override final A_CONST;
bool haveMove3() const override final;
diff --git a/src/net/serverfeatures.h b/src/net/serverfeatures.h
index 009c5cee1..2755efbaa 100644
--- a/src/net/serverfeatures.h
+++ b/src/net/serverfeatures.h
@@ -42,16 +42,12 @@ class ServerFeatures notfinal
virtual bool havePlayerStatusUpdate() const = 0;
- virtual bool haveNativeGuilds() const = 0;
-
virtual bool haveIncompleteChatMessages() const = 0;
virtual bool haveRaceSelection() const = 0;
virtual bool haveLookSelection() const = 0;
- virtual bool haveChatChannels() const = 0;
-
virtual bool haveServerIgnore() const = 0;
virtual bool haveMove3() const = 0;
diff --git a/src/net/tmwa/guildmanager.cpp b/src/net/tmwa/guildmanager.cpp
index c8aa27690..6e22de6ac 100644
--- a/src/net/tmwa/guildmanager.cpp
+++ b/src/net/tmwa/guildmanager.cpp
@@ -72,23 +72,16 @@ GuildManager::~GuildManager()
void GuildManager::init()
{
- if (serverFeatures->haveNativeGuilds())
+ int val = serverConfig.getValue("enableGuildBot", -1);
+ if (val == -1)
{
- mEnableGuildBot = false;
- }
- else
- {
- int val = serverConfig.getValue("enableGuildBot", -1);
- if (val == -1)
- {
- if (client->isTmw())
- val = 1;
- else
- val = 0;
- serverConfig.setValue("enableGuildBot", val);
- }
- mEnableGuildBot = val;
+ if (client->isTmw())
+ val = 1;
+ else
+ val = 0;
+ serverConfig.setValue("enableGuildBot", val);
}
+ mEnableGuildBot = val;
if (mEnableGuildBot)
{
if (!guildManager)
diff --git a/src/net/tmwa/serverfeatures.cpp b/src/net/tmwa/serverfeatures.cpp
index 8cd73884c..1363ac507 100644
--- a/src/net/tmwa/serverfeatures.cpp
+++ b/src/net/tmwa/serverfeatures.cpp
@@ -49,11 +49,6 @@ bool ServerFeatures::havePlayerStatusUpdate() const
return false;
}
-bool ServerFeatures::haveNativeGuilds() const
-{
- return false;
-}
-
bool ServerFeatures::haveIncompleteChatMessages() const
{
return tmwServerVersion <= 0x100209;
@@ -69,11 +64,6 @@ bool ServerFeatures::haveLookSelection() const
return false;
}
-bool ServerFeatures::haveChatChannels() const
-{
- return false;
-}
-
bool ServerFeatures::haveServerIgnore() const
{
return false;
diff --git a/src/net/tmwa/serverfeatures.h b/src/net/tmwa/serverfeatures.h
index 0f0b43547..a252f3f61 100644
--- a/src/net/tmwa/serverfeatures.h
+++ b/src/net/tmwa/serverfeatures.h
@@ -40,16 +40,12 @@ class ServerFeatures final : public Net::ServerFeatures
bool havePlayerStatusUpdate() const override final A_CONST;
- bool haveNativeGuilds() const override final;
-
bool haveIncompleteChatMessages() const override final;
bool haveRaceSelection() const override final A_CONST;
bool haveLookSelection() const override final A_CONST;
- bool haveChatChannels() const override final A_CONST;
-
bool haveServerIgnore() const override final;
bool haveMove3() const override final;
diff --git a/src/utils/chatutils.cpp b/src/utils/chatutils.cpp
index d80e8d761..dc43dc703 100644
--- a/src/utils/chatutils.cpp
+++ b/src/utils/chatutils.cpp
@@ -31,6 +31,7 @@
#include "net/chathandler.h"
#include "net/guildhandler.h"
+#include "net/net.h"
#include "net/partyhandler.h"
#include "net/serverfeatures.h"
@@ -67,17 +68,21 @@ void outStringNormal(ChatTab *const tab,
const Guild *const guild = localPlayer->getGuild();
if (guild)
{
+#ifdef TMWA_SUPPORT
if (guild->getServerGuild())
{
- if (!serverFeatures->haveNativeGuilds())
+ if (Net::getNetworkType() == ServerType::TMWATHENA)
return;
guildHandler->chat(str);
}
-#ifdef TMWA_SUPPORT
else if (guildManager)
{
guildManager->chat(str);
}
+#else // TMWA_SUPPORT
+
+ if (guild->getServerGuild())
+ guildHandler->chat(str);
#endif // TMWA_SUPPORT
}
break;