summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-03-26 23:04:14 -0600
committerJared Adams <jaxad0127@gmail.com>2009-03-26 23:04:14 -0600
commite64b5a25a54f56bc836af57223e37449a1daffe8 (patch)
treef14f80a0bdc5268a2c4e2c70b6afcac080242ac5 /src/game.cpp
parente03bd01fa02da71d41b85d3710a971da5a9c6c32 (diff)
downloadmana-e64b5a25a54f56bc836af57223e37449a1daffe8.tar.gz
mana-e64b5a25a54f56bc836af57223e37449a1daffe8.tar.bz2
mana-e64b5a25a54f56bc836af57223e37449a1daffe8.tar.xz
mana-e64b5a25a54f56bc836af57223e37449a1daffe8.zip
Major clean up of ChatTab handling
ChatTabs now manage their own adding/removal from the chat window, which lost most of it's chat related messages. Whisper handling is stil done by the ChatWindow, but it no longer manages any other tabs. ChannelTab handling is now the sole responsability of the Channels they are attached to. The general tab is handled by Game.
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/game.cpp b/src/game.cpp
index d45387fd..91d8fa3a 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -181,6 +181,7 @@ CommandHandler *commandHandler = NULL;
Particle *particleEngine = NULL;
EffectManager *effectManager = NULL;
+ChatTab *localChatTab = NULL;
#ifdef EATHENA_SUPPORT
Party *playerParty = NULL;
#endif
@@ -287,7 +288,7 @@ void createGuiWindows(Network *network)
emoteShortcutWindow = new ShortcutWindow("emoteShortcut",
new EmoteShortcutContainer);
- chatWindow->addTab(new ChatTab(std::string("General")));
+ localChatTab = new ChatTab(_("General"));
// Set initial window visibility
chatWindow->setVisible((bool) config.getValue(
@@ -330,6 +331,7 @@ void createGuiWindows(Network *network)
void destroyGuiWindows()
{
logger->setChatWindow(NULL);
+ delete localChatTab; // Need to do this first, so it can remove itself
delete chatWindow;
delete statusWindow;
delete miniStatusWindow;
@@ -540,11 +542,11 @@ static bool saveScreenshot()
{
std::stringstream chatlogentry;
chatlogentry << _("Screenshot saved to ~/") << filenameSuffix.str();
- chatWindow->chatLog(chatlogentry.str(), BY_SERVER);
+ localChatTab->chatLog(chatlogentry.str(), BY_SERVER);
}
else
{
- chatWindow->chatLog(_("Saving screenshot failed!"), BY_SERVER);
+ localChatTab->chatLog(_("Saving screenshot failed!"), BY_SERVER);
logger->log("Error: could not save screenshot.");
}
@@ -936,16 +938,16 @@ void Game::handleInput()
unsigned int deflt = player_relations.getDefault();
if (deflt & PlayerRelation::TRADE)
{
- chatWindow->chatLog(
- _("Ignoring incoming trade requests"),
- BY_SERVER);
+ localChatTab->chatLog(
+ _("Ignoring incoming trade requests"),
+ BY_SERVER);
deflt &= ~PlayerRelation::TRADE;
}
else
{
- chatWindow->chatLog(
- _("Accepting incoming trade requests"),
- BY_SERVER);
+ localChatTab->chatLog(
+ _("Accepting incoming trade requests"),
+ BY_SERVER);
deflt |= PlayerRelation::TRADE;
}