From eb8269b40570333ce6a2787dd55f5081c73c14a7 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 27 Aug 2011 20:52:52 +0300 Subject: Fix guild reload if change nick on same account. --- src/game.cpp | 6 ++++++ src/guildmanager.cpp | 18 ++++++++++++++++++ src/guildmanager.h | 2 ++ 3 files changed, 26 insertions(+) diff --git a/src/game.cpp b/src/game.cpp index 6a3a63bb6..8df48b775 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -178,7 +178,10 @@ static void initEngines() channelManager = new ChannelManager; effectManager = new EffectManager; if (!guildManager) + { guildManager = new GuildManager; + guildManager->init(); + } particleEngine = new Particle(NULL); particleEngine->setupEngine(); @@ -334,6 +337,9 @@ static void destroyGuiWindows() del_0(didYouKnowWindow); Mana::Event::trigger(CHANNEL_GAME, Mana::Event(EVENT_GUIWINDOWSUNLOADED)); + + if (guildManager && guildManager->getEnableGuildBot()) + guildManager->reload(); } Game *Game::mInstance = 0; diff --git a/src/guildmanager.cpp b/src/guildmanager.cpp index c929e8598..22b9de5a1 100644 --- a/src/guildmanager.cpp +++ b/src/guildmanager.cpp @@ -68,6 +68,24 @@ void GuildManager::init() mEnableGuildBot = val; } +void GuildManager::reload() +{ + mGotInfo = false; + mGotName = false; + mHavePower = false; + mRequest = false; + mTempList.clear(); + + if (socialWindow) + { + Guild *guild = Guild::getGuild(1); + if (guild) + socialWindow->removeTab(guild); + } + delete mTab; + mTab = 0; +} + void GuildManager::send(std::string msg) { Net::getChatHandler()->privateMessage("guild", msg); diff --git a/src/guildmanager.h b/src/guildmanager.h index 88e1276eb..177cec12a 100644 --- a/src/guildmanager.h +++ b/src/guildmanager.h @@ -68,6 +68,8 @@ class GuildManager void clear(); + void reload(); + bool havePower() { return mHavePower; } -- cgit v1.2.3-70-g09d2