From 53fce496581e70f0d99bf91152cc6d7e802e0974 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 25 Aug 2014 22:49:39 +0300 Subject: Move chat command /target into actions. --- src/actions/commands.cpp | 11 +++++++++++ src/actions/commands.h | 1 + src/commands.cpp | 11 ----------- src/commands.h | 5 +---- src/input/inputaction.h | 1 + src/input/inputactionmap.h | 9 +++++++++ 6 files changed, 23 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index 712850a9f..4ae5d0f49 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -286,4 +286,15 @@ impHandler(move) return false; } +impHandler(setTarget) +{ + if (!actorManager || !localPlayer) + return false; + + Being *const target = actorManager->findNearestByName(event.args); + if (target) + localPlayer->setTarget(target); + return true; +} + } // namespace Actions diff --git a/src/actions/commands.h b/src/actions/commands.h index 35bd27538..8ff28cd00 100644 --- a/src/actions/commands.h +++ b/src/actions/commands.h @@ -39,6 +39,7 @@ namespace Actions decHandler(present); decHandler(printAll); decHandler(move); + decHandler(setTarget); } // namespace Actions #undef decHandler diff --git a/src/commands.cpp b/src/commands.cpp index 80fac44fe..e06017b28 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -166,17 +166,6 @@ impHandler(navigate) return true; } -impHandler(target) -{ - if (!actorManager || !localPlayer) - return false; - - Being *const target = actorManager->findNearestByName(event.args); - if (target) - localPlayer->setTarget(target); - return true; -} - impHandler0(attackHuman) { if (!actorManager || !localPlayer) diff --git a/src/commands.h b/src/commands.h index 71c11113f..9973f3b38 100644 --- a/src/commands.h +++ b/src/commands.h @@ -51,7 +51,6 @@ struct CommandInfo final namespace Commands { - decHandler(target); decHandler(attackHuman); decHandler(outfit); decHandler(emote); @@ -115,8 +114,7 @@ namespace Commands enum { - COMMAND_TARGET = 0, - COMMAND_ATKHUMAN, + COMMAND_ATKHUMAN = 0, COMMAND_OUTFIT, COMMAND_EMOTE, COMMAND_EMOTEPET, @@ -179,7 +177,6 @@ enum static const CommandInfo commands[] = { - {"target", &Commands::target, -1, true}, {"atkhuman", &Commands::attackHuman, -1, true}, {"outfit", &Commands::outfit, -1, true}, {"emote", &Commands::emote, -1, true}, diff --git a/src/input/inputaction.h b/src/input/inputaction.h index aeb2164e6..7c552b908 100644 --- a/src/input/inputaction.h +++ b/src/input/inputaction.h @@ -368,6 +368,7 @@ namespace InputAction PRESENT, PRINT_ALL, MOVE, + TARGET, TOTAL }; } // namespace InputAction diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index 05bb49616..6e0dbd668 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -3082,6 +3082,15 @@ static const InputActionData inputActionData[InputAction::TOTAL] = { InputCondition::INGAME, "move", true}, + {"keySetTarget", + InputType::UNKNOWN, InputAction::NO_VALUE, + InputType::UNKNOWN, InputAction::NO_VALUE, + Input::GRP_DEFAULT, + &Actions::setTarget, + InputAction::NO_VALUE, 50, + InputCondition::INGAME, + "target", + true} }; #endif // INPUT_INPUTACTIONMAP_H -- cgit v1.2.3-70-g09d2