diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-08-25 22:49:39 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-08-25 22:49:39 +0300 |
commit | 53fce496581e70f0d99bf91152cc6d7e802e0974 (patch) | |
tree | da324a2b4767916437a8bffcf65b170ba38008ad | |
parent | 3a091245572872f5cda79eab92eb392f92c02b39 (diff) | |
download | manaplus-53fce496581e70f0d99bf91152cc6d7e802e0974.tar.gz manaplus-53fce496581e70f0d99bf91152cc6d7e802e0974.tar.bz2 manaplus-53fce496581e70f0d99bf91152cc6d7e802e0974.tar.xz manaplus-53fce496581e70f0d99bf91152cc6d7e802e0974.zip |
Move chat command /target into actions.
-rw-r--r-- | src/actions/commands.cpp | 11 | ||||
-rw-r--r-- | src/actions/commands.h | 1 | ||||
-rw-r--r-- | src/commands.cpp | 11 | ||||
-rw-r--r-- | src/commands.h | 5 | ||||
-rw-r--r-- | src/input/inputaction.h | 1 | ||||
-rw-r--r-- | src/input/inputactionmap.h | 9 |
6 files changed, 23 insertions, 15 deletions
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 |