From 753efae71d14bfcb3b36abb1a1455c1c4bd7e4a8 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 13 Dec 2014 15:18:05 +0300 Subject: Add chat command for move all items from inventory to storage. New command: /invtostorageall INDEX Alias: /invstorageall INDEX --- src/actions/actions.cpp | 13 +++++++++++++ src/actions/actions.h | 1 + src/input/inputaction.h | 1 + src/input/inputactionmap.h | 9 +++++++++ 4 files changed, 24 insertions(+) diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp index 135fec27f..36a463da5 100644 --- a/src/actions/actions.cpp +++ b/src/actions/actions.cpp @@ -1434,4 +1434,17 @@ impHandler(invToStorageAll1) return true; } +impHandler(invToStorageAll) +{ + Item *const item = getItemByInvIndex(event); + if (!item) + return true; + + inventoryHandler->moveItem2(Inventory::INVENTORY, + item->getInvIndex(), + item->getQuantity(), + Inventory::STORAGE); + return true; +} + } // namespace Actions diff --git a/src/actions/actions.h b/src/actions/actions.h index 36daa9c21..14027bca9 100644 --- a/src/actions/actions.h +++ b/src/actions/actions.h @@ -102,6 +102,7 @@ namespace Actions decHandler(invToStorage10); decHandler(invToStorageHalf); decHandler(invToStorageAll1); + decHandler(invToStorageAll); } // namespace Actions #undef decHandler diff --git a/src/input/inputaction.h b/src/input/inputaction.h index 044df1ab1..f5c4c927f 100644 --- a/src/input/inputaction.h +++ b/src/input/inputaction.h @@ -509,6 +509,7 @@ namespace InputAction INV_TO_STORAGE_10, INV_TO_STORAGE_HALF, INV_TO_STORAGE_ALL_1, + INV_TO_STORAGE_ALL, TOTAL }; } // namespace InputAction diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index f8427e397..a96353857 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -4324,6 +4324,15 @@ static const InputActionData inputActionData[InputAction::TOTAL] = { InputCondition::INGAME, "invtostorageall1|invstorageall1", true}, + {"keyInvToStorageAll", + InputType::UNKNOWN, InputAction::NO_VALUE, + InputType::UNKNOWN, InputAction::NO_VALUE, + Input::GRP_DEFAULT, + &Actions::invToStorageAll, + InputAction::NO_VALUE, 50, + InputCondition::INGAME, + "invtostorageall|invstorageall", + true}, }; #endif // INPUT_INPUTACTIONMAP_H -- cgit v1.2.3-60-g2f50