From 1b496351f779d4a897cd882a9928a18bab5ba622 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 26 Aug 2014 23:48:31 +0300 Subject: Move chat command /dumpg into actions. --- src/actions/actions.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ src/actions/actions.h | 1 + src/commands.cpp | 41 ----------------------------------------- src/commands.h | 5 +---- src/input/inputaction.h | 1 + src/input/inputactionmap.h | 9 +++++++++ src/input/pages/other.cpp | 6 ++++++ 7 files changed, 59 insertions(+), 45 deletions(-) diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp index d803de671..397b0225d 100644 --- a/src/actions/actions.cpp +++ b/src/actions/actions.cpp @@ -891,4 +891,45 @@ impHandler0(error) exit(1); } +impHandler(dumpGraphics) +{ + std::string str = strprintf("%s,%s,%dX%dX%d,", PACKAGE_OS, SMALL_VERSION, + mainGraphics->getWidth(), mainGraphics->getHeight(), + mainGraphics->getBpp()); + + if (mainGraphics->getFullScreen()) + str.append("F"); + else + str.append("W"); + if (mainGraphics->getHWAccel()) + str.append("H"); + else + str.append("S"); + + if (mainGraphics->getDoubleBuffer()) + str.append("D"); + else + str.append("_"); + +#if defined USE_OPENGL + str.append(strprintf(",%d", mainGraphics->getOpenGL())); +#else + str.append(",0"); +#endif + + str.append(strprintf(",%f,", static_cast(settings.guiAlpha))) + .append(config.getBoolValue("adjustPerfomance") ? "1" : "0") + .append(config.getBoolValue("alphaCache") ? "1" : "0") + .append(config.getBoolValue("enableMapReduce") ? "1" : "0") + .append(config.getBoolValue("beingopacity") ? "1" : "0") + .append(",") + .append(config.getBoolValue("enableAlphaFix") ? "1" : "0") + .append(config.getBoolValue("disableAdvBeingCaching") ? "1" : "0") + .append(config.getBoolValue("disableBeingCaching") ? "1" : "0") + .append(config.getBoolValue("particleeffects") ? "1" : "0") + .append(strprintf(",%d-%d", fps, config.getIntValue("fpslimit"))); + outStringNormal(event.tab, str, str); + return true; +} + } // namespace Actions diff --git a/src/actions/actions.h b/src/actions/actions.h index b773f9992..d1225a424 100644 --- a/src/actions/actions.h +++ b/src/actions/actions.h @@ -72,6 +72,7 @@ namespace Actions decHandler(serverIgnoreAll); decHandler(serverUnIgnoreAll); decHandler(error) __attribute__ ((noreturn)); + decHandler(dumpGraphics); } // namespace Actions #undef decHandler diff --git a/src/commands.cpp b/src/commands.cpp index 283b07e78..bb2bbe813 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -157,47 +157,6 @@ impHandler(hack) return true; } -impHandler(dumpGraphics) -{ - std::string str = strprintf("%s,%s,%dX%dX%d,", PACKAGE_OS, SMALL_VERSION, - mainGraphics->getWidth(), mainGraphics->getHeight(), - mainGraphics->getBpp()); - - if (mainGraphics->getFullScreen()) - str.append("F"); - else - str.append("W"); - if (mainGraphics->getHWAccel()) - str.append("H"); - else - str.append("S"); - - if (mainGraphics->getDoubleBuffer()) - str.append("D"); - else - str.append("_"); - -#if defined USE_OPENGL - str.append(strprintf(",%d", mainGraphics->getOpenGL())); -#else - str.append(",0"); -#endif - - str.append(strprintf(",%f,", static_cast(settings.guiAlpha))) - .append(config.getBoolValue("adjustPerfomance") ? "1" : "0") - .append(config.getBoolValue("alphaCache") ? "1" : "0") - .append(config.getBoolValue("enableMapReduce") ? "1" : "0") - .append(config.getBoolValue("beingopacity") ? "1" : "0") - .append(",") - .append(config.getBoolValue("enableAlphaFix") ? "1" : "0") - .append(config.getBoolValue("disableAdvBeingCaching") ? "1" : "0") - .append(config.getBoolValue("disableBeingCaching") ? "1" : "0") - .append(config.getBoolValue("particleeffects") ? "1" : "0") - .append(strprintf(",%d-%d", fps, config.getIntValue("fpslimit"))); - outStringNormal(event.tab, str, str); - return true; -} - impHandler0(dumpEnvironment) { logger->log1("Start environment variables"); diff --git a/src/commands.h b/src/commands.h index 9cfb87d98..3c9437c37 100644 --- a/src/commands.h +++ b/src/commands.h @@ -54,7 +54,6 @@ namespace Commands decHandler(hack); decHandler(url); decHandler(open); - decHandler(dumpGraphics); decHandler(dumpEnvironment); decHandler(dumpTests); decHandler(dumpOGL); @@ -83,8 +82,7 @@ namespace Commands enum { - COMMAND_DUMPG = 0, - COMMAND_DUMPE, + COMMAND_DUMPE = 0, COMMAND_DUMPT, COMMAND_DUMPOGL, COMMAND_DUMPGL, @@ -114,7 +112,6 @@ enum static const CommandInfo commands[] = { - {"dumpg", &Commands::dumpGraphics, -1, false}, {"dumpe", &Commands::dumpEnvironment, -1, false}, {"dumpt", &Commands::dumpTests, -1, false}, {"dumpogl", &Commands::dumpOGL, -1, false}, diff --git a/src/input/inputaction.h b/src/input/inputaction.h index aa69f4a19..87cb80914 100644 --- a/src/input/inputaction.h +++ b/src/input/inputaction.h @@ -398,6 +398,7 @@ namespace InputAction SERVER_UNIGNORE_ALL, SET_DROP, ERROR, + DUMP_GRAPHICS, TOTAL }; } // namespace InputAction diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index 4b9150aa8..7d80d63fe 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -3351,6 +3351,15 @@ static const InputActionData inputActionData[InputAction::TOTAL] = { InputAction::NO_VALUE, 50, InputCondition::INGAME, "error", + false}, + {"keyDumpg", + InputType::UNKNOWN, InputAction::NO_VALUE, + InputType::UNKNOWN, InputAction::NO_VALUE, + Input::GRP_DEFAULT, + &Actions::dumpGraphics, + InputAction::NO_VALUE, 50, + InputCondition::INGAME, + "dumpg", false} }; diff --git a/src/input/pages/other.cpp b/src/input/pages/other.cpp index 8bae75449..658c368f2 100644 --- a/src/input/pages/other.cpp +++ b/src/input/pages/other.cpp @@ -291,6 +291,12 @@ SetupActionData setupActionDataOther[] = InputAction::ERROR, "", }, + { + // TRANSLATORS: input action name + N_("Dump graphics info into chat"), + InputAction::DUMP_GRAPHICS, + "", + }, { "", InputAction::NO_VALUE, -- cgit v1.2.3-70-g09d2