summaryrefslogtreecommitdiff
path: root/src/commandhandler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-10-27 22:17:21 +0300
committerAndrei Karas <akaras@inbox.ru>2011-10-27 22:17:21 +0300
commitcd0b35a6c1a86e4432d9dc9ec75b4da0ae9a7bdc (patch)
tree6e09b953731887801b35f61056c2c87991e05590 /src/commandhandler.cpp
parentc905067448700c63f7645b08d80bffbde57a45fa (diff)
downloadplus-cd0b35a6c1a86e4432d9dc9ec75b4da0ae9a7bdc.tar.gz
plus-cd0b35a6c1a86e4432d9dc9ec75b4da0ae9a7bdc.tar.bz2
plus-cd0b35a6c1a86e4432d9dc9ec75b4da0ae9a7bdc.tar.xz
plus-cd0b35a6c1a86e4432d9dc9ec75b4da0ae9a7bdc.zip
Add command to dump to chat main graphics settings.
Command: /dumpg
Diffstat (limited to 'src/commandhandler.cpp')
-rw-r--r--src/commandhandler.cpp57
1 files changed, 54 insertions, 3 deletions
diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp
index 7a4773d81..cac12b8ec 100644
--- a/src/commandhandler.cpp
+++ b/src/commandhandler.cpp
@@ -26,6 +26,7 @@
#include "actorspritemanager.h"
#include "channelmanager.h"
#include "channel.h"
+#include "configuration.h"
#include "game.h"
#include "guildmanager.h"
#include "localplayer.h"
@@ -194,6 +195,8 @@ void CommandHandler::handleCommand(const std::string &command, ChatTab *tab)
handleServerIgnoreAll(args, tab);
else if (type == "serverunignoreall")
handleServerUnIgnoreAll(args, tab);
+ else if (type == "dumpg")
+ handleDumpGraphics(args, tab);
else if (tab->handleCommand(type, args))
;
else if (type == "hack")
@@ -377,13 +380,19 @@ 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);
+}
+
+void CommandHandler::outString(ChatTab *tab, const std::string &str,
+ const std::string &def)
+{
if (!tab)
{
- Net::getChatHandler()->me(args);
+ Net::getChatHandler()->me(def);
return;
}
- const std::string str = strprintf("*%s*", args.c_str());
switch (tab->getType())
{
case ChatTab::TAB_PARTY:
@@ -406,7 +415,7 @@ void CommandHandler::handleMe(const std::string &args, ChatTab *tab)
break;
}
default:
- Net::getChatHandler()->me(args);
+ Net::getChatHandler()->me(def);
break;
}
}
@@ -1036,6 +1045,48 @@ void CommandHandler::handleServerUnIgnoreAll(const std::string &args,
Net::getChatHandler()->unIgnoreAll();
}
+void CommandHandler::handleDumpGraphics(const std::string &args, ChatTab *tab)
+{
+ std::string str;
+ str = strprintf ("%s,%s,%dX%dX%d,", PACKAGE_OS, SMALL_VERSION,
+ mainGraphics->getWidth(), mainGraphics->getHeight(),
+ mainGraphics->getBpp());
+
+ if (mainGraphics->getFullScreen())
+ str += "F";
+ else
+ str += "W";
+ if (mainGraphics->getHWAccel())
+ str += "H";
+ else
+ str += "S";
+
+ if (mainGraphics->getDoubleBuffer())
+ str += "D";
+ else
+ str += "_";
+
+#if defined USE_OPENGL
+ str += strprintf(",%d", mainGraphics->getOpenGL());
+#else
+ str += ",0";
+#endif
+
+ str += strprintf(",%f,", Client::getGuiAlpha());
+ str += config.getBoolValue("adjustPerfomance") ? "1" : "0";
+ str += config.getBoolValue("alphaCache") ? "1" : "0";
+ str += config.getBoolValue("enableMapReduce") ? "1" : "0";
+ str += config.getBoolValue("beingopacity") ? "1" : "0";
+ str += ",";
+ str += config.getBoolValue("enableAlphaFix") ? "1" : "0";
+ str += config.getBoolValue("disableAdvBeingCaching") ? "1" : "0";
+ str += config.getBoolValue("disableBeingCaching") ? "1" : "0";
+ str += config.getBoolValue("particleeffects") ? "1" : "0";
+
+ str += strprintf(",%d-%d", fps, config.getIntValue("fpslimit"));
+ outString(tab, str, str);
+}
+
#ifdef DEBUG_DUMP_LEAKS
void showRes(std::string str, ResourceManager::Resources *res);