From 2018073c8ec531d936321f2e6561b68d386f36a5 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 26 Aug 2014 02:28:51 +0300 Subject: Move chat command /heal into actions. --- src/actions/actions.cpp | 14 ++++++++++++-- src/commands.cpp | 19 ------------------- src/commands.h | 5 +---- src/input/inputactionmap.h | 4 ++-- 4 files changed, 15 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp index 2eda2b6f3..251204df4 100644 --- a/src/actions/actions.cpp +++ b/src/actions/actions.cpp @@ -236,7 +236,14 @@ impHandler0(heal) { if (actorManager) { - if (inputManager.isActionActive(InputAction::STOP_ATTACK)) + if (!event.args.empty()) + { + const Being *const being = actorManager->findBeingByName( + event.args, ActorType::PLAYER); + if (being) + actorManager->heal(being); + } + else if (inputManager.isActionActive(InputAction::STOP_ATTACK)) { Being *target = localPlayer->getTarget(); if (!target || target->getType() != ActorType::PLAYER) @@ -247,8 +254,11 @@ impHandler0(heal) localPlayer->setTarget(target); } } + else + { + actorManager->heal(localPlayer); + } - actorManager->healTarget(); if (Game::instance()) Game::instance()->setValidSpeed(); return true; diff --git a/src/commands.cpp b/src/commands.cpp index 7494c45d2..38683ea2a 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -180,25 +180,6 @@ impHandler(imitation) return true; } -impHandler(heal) -{ - if (!actorManager) - return false; - - if (!event.args.empty()) - { - const Being *const being = actorManager->findBeingByName( - event.args, ActorType::PLAYER); - if (being) - actorManager->heal(being); - } - else - { - actorManager->heal(localPlayer); - } - return true; -} - impHandler(hack) { Net::getChatHandler()->sendRaw(event.args); diff --git a/src/commands.h b/src/commands.h index 28add6b34..84f6b20d0 100644 --- a/src/commands.h +++ b/src/commands.h @@ -52,7 +52,6 @@ struct CommandInfo final namespace Commands { decHandler(imitation); - decHandler(heal); decHandler(navigate); decHandler(mail); decHandler(hack); @@ -107,8 +106,7 @@ namespace Commands enum { - COMMAND_HEAL = 0, - COMMAND_NAVIGATE, + COMMAND_NAVIGATE = 0, COMMAND_IMITATION, COMMAND_MAIL, COMMAND_TRADE, @@ -163,7 +161,6 @@ enum static const CommandInfo commands[] = { - {"heal", &Commands::heal, -1, true}, {"navigate", &Commands::navigate, -1, true}, {"imitation", &Commands::imitation, -1, true}, {"mail", &Commands::mail, -1, true}, diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index e773dffdb..533771384 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -2210,8 +2210,8 @@ static const InputActionData inputActionData[InputAction::TOTAL] = { &Actions::heal, InputAction::NO_VALUE, 50, InputCondition::GAME | InputCondition::VALIDSPEED, - "", - false}, + "heal", + true}, {"keyMagicItenplz", InputType::KEYBOARD, SDLK_m, InputType::UNKNOWN, InputAction::NO_VALUE, -- cgit v1.2.3-70-g09d2