summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-08-26 15:05:48 +0300
committerAndrei Karas <akaras@inbox.ru>2014-08-26 15:05:48 +0300
commitb44ae759ff5a848b7c6d15dc80bba4e7a6948575 (patch)
tree17a577d75124c622fb00b516c95f15cc350b374a /src
parentce0c0778675908f7be557b1c115de3eabb828079 (diff)
downloadmanaverse-b44ae759ff5a848b7c6d15dc80bba4e7a6948575.tar.gz
manaverse-b44ae759ff5a848b7c6d15dc80bba4e7a6948575.tar.bz2
manaverse-b44ae759ff5a848b7c6d15dc80bba4e7a6948575.tar.xz
manaverse-b44ae759ff5a848b7c6d15dc80bba4e7a6948575.zip
Move chat command /trade into actions.
Diffstat (limited to 'src')
-rw-r--r--src/actions/actions.cpp19
-rw-r--r--src/actions/actions.h1
-rw-r--r--src/commands.cpp17
-rw-r--r--src/commands.h5
-rw-r--r--src/defaults.cpp2
-rw-r--r--src/input/inputaction.h3
-rw-r--r--src/input/inputactionmap.h9
-rw-r--r--src/input/pages/basic.cpp8
8 files changed, 40 insertions, 24 deletions
diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp
index 251204df4..9d1279e3f 100644
--- a/src/actions/actions.cpp
+++ b/src/actions/actions.cpp
@@ -596,4 +596,23 @@ impHandler0(cleanFonts)
return true;
}
+impHandler(trade)
+{
+ if (!actorManager)
+ return false;
+
+ const Being *being = actorManager->findBeingByName(
+ event.args, ActorType::PLAYER);
+ if (!being)
+ being = localPlayer->getTarget();
+ if (being)
+ {
+ Net::getTradeHandler()->request(being);
+ tradePartnerName = being->getName();
+ if (tradeWindow)
+ tradeWindow->clear();
+ }
+ return true;
+}
+
} // namespace Actions
diff --git a/src/actions/actions.h b/src/actions/actions.h
index 92d293df4..ea9faadab 100644
--- a/src/actions/actions.h
+++ b/src/actions/actions.h
@@ -60,6 +60,7 @@ namespace Actions
decHandler(cleanGraphics);
decHandler(cleanFonts);
decHandler(attackHuman);
+ decHandler(trade);
} // namespace Actions
#undef decHandler
diff --git a/src/commands.cpp b/src/commands.cpp
index 72ba9f6c1..52a9dbb2a 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -206,23 +206,6 @@ impHandler(attack)
return true;
}
-impHandler(trade)
-{
- if (!actorManager)
- return false;
-
- const Being *const being = actorManager->findBeingByName(
- event.args, ActorType::PLAYER);
- if (being)
- {
- Net::getTradeHandler()->request(being);
- tradePartnerName = being->getName();
- if (tradeWindow)
- tradeWindow->clear();
- }
- return true;
-}
-
impHandler0(dirs)
{
if (!localPlayer || !debugChatTab)
diff --git a/src/commands.h b/src/commands.h
index b09979050..58f3bf176 100644
--- a/src/commands.h
+++ b/src/commands.h
@@ -54,7 +54,6 @@ namespace Commands
decHandler(hack);
decHandler(priceLoad);
decHandler(priceSave);
- decHandler(trade);
decHandler(disconnect);
decHandler(undress);
decHandler(attack);
@@ -103,8 +102,7 @@ namespace Commands
enum
{
- COMMAND_TRADE = 0,
- COMMAND_PRICELOAD,
+ COMMAND_PRICELOAD = 0,
COMMAND_PRICESAVE,
COMMAND_CACHEINFO,
COMMAND_DISCONNECT,
@@ -155,7 +153,6 @@ enum
static const CommandInfo commands[] =
{
- {"trade", &Commands::trade, -1, true},
{"priceload", &Commands::priceLoad, -1, false},
{"pricesave", &Commands::priceSave, -1, false},
{"cacheinfo", &Commands::cacheInfo, -1, false},
diff --git a/src/defaults.cpp b/src/defaults.cpp
index caaf69774..6e095a629 100644
--- a/src/defaults.cpp
+++ b/src/defaults.cpp
@@ -336,7 +336,7 @@ DefaultsData* getConfigDefaults()
AddDEF("screenActionButton7", InputAction::WINDOW_SKILL);
AddDEF("screenActionButton8", InputAction::WINDOW_SOCIAL);
AddDEF("screenActionButton9", InputAction::WINDOW_DEBUG);
- AddDEF("screenActionButton10", InputAction::TRADE);
+ AddDEF("screenActionButton10", InputAction::CHANGE_TRADE);
AddDEF("screenActionButton11", InputAction::DIRECT_DOWN);
AddDEF("screenButtonsFormat", 0);
AddDEF("autoresizeminimaps", false);
diff --git a/src/input/inputaction.h b/src/input/inputaction.h
index dae8cbf53..d278e9799 100644
--- a/src/input/inputaction.h
+++ b/src/input/inputaction.h
@@ -57,7 +57,7 @@ namespace InputAction
HIDE_WINDOWS,
SIT,
SCREENSHOT,
- TRADE,
+ CHANGE_TRADE,
PATHFIND,
OK,
QUIT,
@@ -379,6 +379,7 @@ namespace InputAction
NAVIGATE,
IMITATION,
SEND_MAIL,
+ TRADE,
TOTAL
};
} // namespace InputAction
diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h
index 6657b0909..58688fc27 100644
--- a/src/input/inputactionmap.h
+++ b/src/input/inputactionmap.h
@@ -3180,6 +3180,15 @@ static const InputActionData inputActionData[InputAction::TOTAL] = {
InputAction::NO_VALUE, 50,
InputCondition::INGAME,
"mail",
+ true},
+ {"keyTradeCommand",
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ Input::GRP_DEFAULT,
+ &Actions::trade,
+ InputAction::NO_VALUE, 50,
+ InputCondition::INGAME,
+ "trade",
true}
};
diff --git a/src/input/pages/basic.cpp b/src/input/pages/basic.cpp
index 2c784d804..ee65d48fe 100644
--- a/src/input/pages/basic.cpp
+++ b/src/input/pages/basic.cpp
@@ -162,7 +162,7 @@ SetupActionData setupActionDataBasic[] =
{
// TRANSLATORS: input action name
N_("Enable/Disable Trading"),
- InputAction::TRADE,
+ InputAction::CHANGE_TRADE,
"",
},
{
@@ -173,6 +173,12 @@ SetupActionData setupActionDataBasic[] =
},
{
// TRANSLATORS: input action name
+ N_("Start trade with target"),
+ InputAction::TRADE,
+ "",
+ },
+ {
+ // TRANSLATORS: input action name
N_("Follow selected player"),
InputAction::FOLLOW,
"",