From 4228763829f71ec4db50ed185483d7707c5e47eb Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 17 Sep 2014 10:50:22 +0300 Subject: Remove getter for guildHandler. --- src/actions/chat.cpp | 4 ++-- src/actions/commands.cpp | 2 +- src/client.cpp | 2 +- src/gui/popups/popupmenu.cpp | 6 +++--- src/gui/widgets/tabs/socialguildtab.h | 4 ++-- src/gui/windows/socialwindow.cpp | 6 +++--- src/net/ea/gui/guildtab.cpp | 12 ++++++------ src/net/guildhandler.h | 2 ++ src/net/net.cpp | 6 +----- src/net/net.h | 2 -- src/notifymanager.cpp | 2 +- src/utils/chatutils.cpp | 2 +- 12 files changed, 23 insertions(+), 27 deletions(-) diff --git a/src/actions/chat.cpp b/src/actions/chat.cpp index 3c6b4f7fc..b5e507924 100644 --- a/src/actions/chat.cpp +++ b/src/actions/chat.cpp @@ -75,7 +75,7 @@ static void outString(const ChatTab *const tab, { if (!Net::getServerFeatures()->haveNativeGuilds()) return; - Net::getGuildHandler()->chat(guild->getId(), str); + guildHandler->chat(guild->getId(), str); } else if (guildManager) { @@ -282,7 +282,7 @@ impHandler(createGuild) } else { - Net::getGuildHandler()->create(event.args); + guildHandler->create(event.args); } return true; } diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index a1ae6b32c..d5c2f5096 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -422,7 +422,7 @@ impHandler(info) { const Guild *const guild = localPlayer->getGuild(); if (guild) - Net::getGuildHandler()->info(guild->getId()); + guildHandler->info(guild->getId()); break; } default: diff --git a/src/client.cpp b/src/client.cpp index 88c9766e0..63f5f1852 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -956,7 +956,7 @@ int Client::gameExec() Party::clearParties(); Guild::clearGuilds(); NpcDialog::clearDialogs(); - Net::getGuildHandler()->clear(); + guildHandler->clear(); Net::getPartyHandler()->clear(); if (chatLogger) chatLogger->clear(); diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 89de39145..8e9939991 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -1024,7 +1024,7 @@ void PopupMenu::handleLink(const std::string &link, if (guild) { if (guild->getServerGuild()) - Net::getGuildHandler()->invite(guild->getId(), mNick); + guildHandler->invite(guild->getId(), mNick); else if (guildManager) guildManager->invite(mNick); } @@ -1437,7 +1437,7 @@ void PopupMenu::handleLink(const std::string &link, if (guild) { if (guild->getServerGuild()) - Net::getGuildHandler()->kick(guild->getMember(mNick), ""); + guildHandler->kick(guild->getMember(mNick), ""); else if (guildManager) guildManager->kick(mNick); } @@ -1826,7 +1826,7 @@ void PopupMenu::handleLink(const std::string &link, const Guild *const guild = localPlayer->getGuild(); if (guild) { - Net::getGuildHandler()->changeMemberPostion( + guildHandler->changeMemberPostion( guild->getMember(mNick), num); } } diff --git a/src/gui/widgets/tabs/socialguildtab.h b/src/gui/widgets/tabs/socialguildtab.h index ba9127418..ed9261133 100644 --- a/src/gui/widgets/tabs/socialguildtab.h +++ b/src/gui/widgets/tabs/socialguildtab.h @@ -75,7 +75,7 @@ class SocialGuildTab final : public SocialTab, if (eventId == "do invite") { const std::string name = mInviteDialog->getText(); - Net::getGuildHandler()->invite(mGuild->getId(), name); + guildHandler->invite(mGuild->getId(), name); if (localChatTab) { @@ -94,7 +94,7 @@ class SocialGuildTab final : public SocialTab, } else if (eventId == "yes") { - Net::getGuildHandler()->leave(mGuild->getId()); + guildHandler->leave(mGuild->getId()); if (localChatTab) { // TRANSLATORS: chat message diff --git a/src/gui/windows/socialwindow.cpp b/src/gui/windows/socialwindow.cpp index 500f72b66..5b7868abb 100644 --- a/src/gui/windows/socialwindow.cpp +++ b/src/gui/windows/socialwindow.cpp @@ -306,7 +306,7 @@ void SocialWindow::action(const ActionEvent &event) mPartyInviter.c_str())); } if (!guildManager || !GuildManager::getEnableGuildBot()) - Net::getGuildHandler()->inviteResponse(mGuildInvited, true); + guildHandler->inviteResponse(mGuildInvited, true); else guildManager->inviteResponse(true); } @@ -320,7 +320,7 @@ void SocialWindow::action(const ActionEvent &event) mPartyInviter.c_str())); } if (!guildManager || !GuildManager::getEnableGuildBot()) - Net::getGuildHandler()->inviteResponse(mGuildInvited, false); + guildHandler->inviteResponse(mGuildInvited, false); else guildManager->inviteResponse(false); } @@ -352,7 +352,7 @@ void SocialWindow::action(const ActionEvent &event) if (name.size() > 16) return; - Net::getGuildHandler()->create(name); + guildHandler->create(name); if (localChatTab) { // TRANSLATORS: chat message diff --git a/src/net/ea/gui/guildtab.cpp b/src/net/ea/gui/guildtab.cpp index 43e759e39..996c8fd58 100644 --- a/src/net/ea/gui/guildtab.cpp +++ b/src/net/ea/gui/guildtab.cpp @@ -70,20 +70,20 @@ bool GuildTab::handleCommand(const std::string &restrict type, if (args.empty()) chatLog(_("Guild name is missing."), ChatMsgType::BY_SERVER); else - Net::getGuildHandler()->create(args); + guildHandler->create(args); } */ if (type == "invite" && taGuild) { - Net::getGuildHandler()->invite(taGuild->getId(), args); + guildHandler->invite(taGuild->getId(), args); } else if (type == "leave" && taGuild) { - Net::getGuildHandler()->leave(taGuild->getId()); + guildHandler->leave(taGuild->getId()); } else if (type == "kick" && taGuild) { - Net::getGuildHandler()->kick(taGuild->getMember(args), ""); + guildHandler->kick(taGuild->getMember(args), ""); } else if (type == "notice" && taGuild) { @@ -91,7 +91,7 @@ bool GuildTab::handleCommand(const std::string &restrict type, std::string str2(""); if (args.size() > 60) str2 = args.substr(60); - Net::getGuildHandler()->changeNotice(taGuild->getId(), str1, str2); + guildHandler->changeNotice(taGuild->getId(), str1, str2); } else { @@ -106,7 +106,7 @@ void GuildTab::handleInput(const std::string &msg) if (!taGuild) return; - Net::getGuildHandler()->chat(taGuild->getId(), + guildHandler->chat(taGuild->getId(), ChatWindow::doReplace(msg)); } diff --git a/src/net/guildhandler.h b/src/net/guildhandler.h index 2972b4f23..2964af16d 100644 --- a/src/net/guildhandler.h +++ b/src/net/guildhandler.h @@ -89,4 +89,6 @@ class GuildHandler notfinal } // namespace Net +extern Net::GuildHandler *guildHandler; + #endif // NET_GUILDHANDLER_H diff --git a/src/net/net.cpp b/src/net/net.cpp index b8b292f98..feed36ea0 100644 --- a/src/net/net.cpp +++ b/src/net/net.cpp @@ -49,6 +49,7 @@ namespace Net class FamilyHandler; class GameHandler; class GeneralHandler; + class GuildHandler; } Net::AdminHandler *adminHandler = nullptr; @@ -74,11 +75,6 @@ Net::CashShopHandler *cashShopHandler = nullptr; Net::FamilyHandler *familyHandler = nullptr; Net::BankHandler *bankHandler = nullptr; -Net::GuildHandler *Net::getGuildHandler() -{ - return guildHandler; -} - Net::InventoryHandler *Net::getInventoryHandler() { return inventoryHandler; diff --git a/src/net/net.h b/src/net/net.h index b0fb224bd..71cbcc21e 100644 --- a/src/net/net.h +++ b/src/net/net.h @@ -36,7 +36,6 @@ namespace Net { -class GuildHandler; class InventoryHandler; class LoginHandler; class MailHandler; @@ -48,7 +47,6 @@ class SkillHandler; class TradeHandler; class ServerFeatures; -GuildHandler *getGuildHandler() A_WARN_UNUSED; InventoryHandler *getInventoryHandler() A_WARN_UNUSED; LoginHandler *getLoginHandler() A_WARN_UNUSED; NpcHandler *getNpcHandler() A_WARN_UNUSED; diff --git a/src/notifymanager.cpp b/src/notifymanager.cpp index a31773f08..4d885c86d 100644 --- a/src/notifymanager.cpp +++ b/src/notifymanager.cpp @@ -46,7 +46,7 @@ namespace NotifyManager if (guild) { if (guild->getServerGuild()) - return Net::getGuildHandler()->getTab(); + return guildHandler->getTab(); else if (guildManager) return guildManager->getTab(); } diff --git a/src/utils/chatutils.cpp b/src/utils/chatutils.cpp index a3322a370..926d696fb 100644 --- a/src/utils/chatutils.cpp +++ b/src/utils/chatutils.cpp @@ -68,7 +68,7 @@ void outStringNormal(ChatTab *const tab, { if (!Net::getServerFeatures()->haveNativeGuilds()) return; - Net::getGuildHandler()->chat(guild->getId(), str); + guildHandler->chat(guild->getId(), str); } else if (guildManager) { -- cgit v1.2.3-70-g09d2