summaryrefslogtreecommitdiff
path: root/src/commandhandler.cpp
diff options
context:
space:
mode:
authorReid <reidyaro@gmail.com>2012-01-25 22:05:36 +0100
committerReid <reidyaro@gmail.com>2012-01-25 22:05:36 +0100
commit8b612abb42853a22c1a9545e2c9280d154646543 (patch)
treef466167087c2b2de4b8aa9e6d1d1986f72f84147 /src/commandhandler.cpp
parenta913dd41df61760de6ece552f941e002251ff54c (diff)
parentd340b5a27a8f3b05d1764da9c114f5f59bd0cd46 (diff)
downloadplus-8b612abb42853a22c1a9545e2c9280d154646543.tar.gz
plus-8b612abb42853a22c1a9545e2c9280d154646543.tar.bz2
plus-8b612abb42853a22c1a9545e2c9280d154646543.tar.xz
plus-8b612abb42853a22c1a9545e2c9280d154646543.zip
Merge branch 'master' of gitorious.org:manaplus/manaplus
Diffstat (limited to 'src/commandhandler.cpp')
-rw-r--r--src/commandhandler.cpp62
1 files changed, 58 insertions, 4 deletions
diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp
index 862ac56b4..0f1e60a25 100644
--- a/src/commandhandler.cpp
+++ b/src/commandhandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -202,6 +202,8 @@ void CommandHandler::handleCommand(const std::string &command, ChatTab *tab)
handleServerUnIgnoreAll(args, tab);
else if (type == "dumpg")
handleDumpGraphics(args, tab);
+ else if (type == "dumpt")
+ handleDumpTests(args, tab);
else if (tab->handleCommand(type, args))
;
else if (type == "hack")
@@ -406,7 +408,6 @@ void CommandHandler::handleParty(const std::string &args, ChatTab *tab)
void CommandHandler::handleMe(const std::string &args, ChatTab *tab)
{
- const std::string str = strprintf("*%s*", args.c_str());
outString(tab, strprintf("*%s*", args.c_str()), args);
}
@@ -1111,7 +1112,7 @@ void CommandHandler::handleDumpGraphics(const std::string &args A_UNUSED,
str += ",0";
#endif
- str += strprintf(",%f,", Client::getGuiAlpha());
+ str += strprintf(",%f,", static_cast<double>(Client::getGuiAlpha()));
str += config.getBoolValue("adjustPerfomance") ? "1" : "0";
str += config.getBoolValue("alphaCache") ? "1" : "0";
str += config.getBoolValue("enableMapReduce") ? "1" : "0";
@@ -1123,7 +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");
+ 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