From 368931eb3af8153f8bba5cae9ff89ad57bb4a1b7 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 1 May 2015 01:03:44 +0300 Subject: Add chat command to set serverconfig variables. New chat command: /servconfset varname value Alias: /setservconf varname value --- src/actions/commands.cpp | 13 +++++++++++++ src/actions/commands.h | 1 + src/input/inputaction.h | 1 + src/input/inputactionmap.h | 5 +++++ 4 files changed, 20 insertions(+) diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index 75d491f9e..e5ad161e3 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -922,4 +922,17 @@ impHandler(confSet) return false; } +impHandler(serverConfSet) +{ + std::string name; + std::string val; + + if (parse2Str(event.args, name, val)) + { + serverConfig.setValue(name, val); + return true; + } + return false; +} + } // namespace Actions diff --git a/src/actions/commands.h b/src/actions/commands.h index e2360ad8f..d97d73663 100644 --- a/src/actions/commands.h +++ b/src/actions/commands.h @@ -86,6 +86,7 @@ namespace Actions decHandler(joinChatRoom); decHandler(leaveChatRoom); decHandler(confSet); + decHandler(serverConfSet); } // namespace Actions #undef decHandler diff --git a/src/input/inputaction.h b/src/input/inputaction.h index b927f06f7..f6e172244 100644 --- a/src/input/inputaction.h +++ b/src/input/inputaction.h @@ -597,6 +597,7 @@ namespace InputAction WINDOW_QUICK_SETTINGS, WINDOW_MAIL, CONF_SET, + SERVER_CONF_SET, TOTAL }; } // namespace InputAction diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index 0aa8adea1..e5ed5c5d1 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -4474,6 +4474,11 @@ static const InputActionData inputActionData[InputAction::TOTAL] = { InputCondition::INGAME, "confset|setconf", true}, + {"keyServerConfSet", + defaultAction(&Actions::serverConfSet), + InputCondition::INGAME, + "servconfset|setservconf", + true}, }; #undef defaultAction -- cgit v1.2.3-70-g09d2