summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-01-07 20:03:24 +0300
committerAndrei Karas <akaras@inbox.ru>2012-01-07 20:25:47 +0300
commit7048f43f0683b62985e265df09657efd60025e58 (patch)
tree4c98ff3873ad185720a702f550e799f22dda9333 /src
parent78ef5eee69ace485763ce44267d8d475abf4adc2 (diff)
downloadmanaverse-7048f43f0683b62985e265df09657efd60025e58.tar.gz
manaverse-7048f43f0683b62985e265df09657efd60025e58.tar.bz2
manaverse-7048f43f0683b62985e265df09657efd60025e58.tar.xz
manaverse-7048f43f0683b62985e265df09657efd60025e58.zip
Fix tab for debug messages.
Diffstat (limited to 'src')
-rw-r--r--src/commandhandler.cpp50
-rw-r--r--src/commandhandler.h3
2 files changed, 51 insertions, 2 deletions
diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp
index 6f2c2867d..0f8df546c 100644
--- a/src/commandhandler.cpp
+++ b/src/commandhandler.cpp
@@ -1124,14 +1124,60 @@ void CommandHandler::handleDumpGraphics(const std::string &args A_UNUSED,
str += config.getBoolValue("particleeffects") ? "1" : "0";
str += strprintf(",%d-%d", fps, config.getIntValue("fpslimit"));
- outString(tab, str, str);
+ outStringNormal(tab, str, str);
}
void CommandHandler::handleDumpTests(const std::string &args A_UNUSED,
ChatTab *tab)
{
std::string str = config.getStringValue("testInfo");
- outString(tab, str, str);
+ outStringNormal(tab, str, str);
+}
+
+void CommandHandler::outStringNormal(ChatTab *tab, const std::string &str,
+ const std::string &def)
+{
+ if (!player_node)
+ return;
+
+ if (!tab)
+ {
+ Net::getChatHandler()->talk(str);
+ return;
+ }
+
+ switch (tab->getType())
+ {
+ case ChatTab::TAB_PARTY:
+ {
+ Net::getPartyHandler()->chat(str);
+ break;
+ }
+ case ChatTab::TAB_GUILD:
+ {
+ if (!player_node)
+ return;
+ const Guild *guild = player_node->getGuild();
+ if (guild)
+ {
+ if (guild->getServerGuild())
+ Net::getGuildHandler()->chat(guild->getId(), str);
+ else if (guildManager)
+ guildManager->chat(str);
+ }
+ break;
+ }
+ case ChatTab::TAB_WHISPER:
+ {
+ WhisperTab *whisper = static_cast<WhisperTab*>(tab);
+ tab->chatLog(player_node->getName(), str);
+ Net::getChatHandler()->privateMessage(whisper->getNick(), str);
+ break;
+ }
+ default:
+ Net::getChatHandler()->talk(def);
+ break;
+ }
}
#ifdef DEBUG_DUMP_LEAKS
diff --git a/src/commandhandler.h b/src/commandhandler.h
index d9f11059b..16e5e94ce 100644
--- a/src/commandhandler.h
+++ b/src/commandhandler.h
@@ -304,6 +304,9 @@ class CommandHandler
void outString(ChatTab *tab, const std::string &str,
const std::string &def);
+ void outStringNormal(ChatTab *tab, const std::string &str,
+ const std::string &def);
+
void handleCacheInfo(const std::string &args, ChatTab *tab);
bool parse2Int(const std::string &args, int *x, int *y);