diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-12-13 15:11:52 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-12-13 15:11:52 +0300 |
commit | dff25ba3ef8724b4f26f978df27dec1e337ce23c (patch) | |
tree | 551e6347567274685513076252f2eb8ca8bdd923 | |
parent | f5d2d18e9d965e8341ee806293c4d5eb4963a019 (diff) | |
download | manaplus-dff25ba3ef8724b4f26f978df27dec1e337ce23c.tar.gz manaplus-dff25ba3ef8724b4f26f978df27dec1e337ce23c.tar.bz2 manaplus-dff25ba3ef8724b4f26f978df27dec1e337ce23c.tar.xz manaplus-dff25ba3ef8724b4f26f978df27dec1e337ce23c.zip |
Add chat command for move all except 1 items from inventory to storage.
New command: /invtostorageall1 INDEX
Alias: /invstorageall1 INDEX
-rw-r--r-- | src/actions/actions.cpp | 13 | ||||
-rw-r--r-- | src/actions/actions.h | 1 | ||||
-rw-r--r-- | src/input/inputaction.h | 1 | ||||
-rw-r--r-- | src/input/inputactionmap.h | 9 |
4 files changed, 24 insertions, 0 deletions
diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp index 0b501bdbf..135fec27f 100644 --- a/src/actions/actions.cpp +++ b/src/actions/actions.cpp @@ -1421,4 +1421,17 @@ impHandler(invToStorageHalf) return true; } +impHandler(invToStorageAll1) +{ + Item *const item = getItemByInvIndex(event); + if (!item) + return true; + + inventoryHandler->moveItem2(Inventory::INVENTORY, + item->getInvIndex(), + item->getQuantity() - 1, + Inventory::STORAGE); + return true; +} + } // namespace Actions diff --git a/src/actions/actions.h b/src/actions/actions.h index 0ab312351..36daa9c21 100644 --- a/src/actions/actions.h +++ b/src/actions/actions.h @@ -101,6 +101,7 @@ namespace Actions decHandler(invToStorage); decHandler(invToStorage10); decHandler(invToStorageHalf); + decHandler(invToStorageAll1); } // namespace Actions #undef decHandler diff --git a/src/input/inputaction.h b/src/input/inputaction.h index 2cbfe8ab1..044df1ab1 100644 --- a/src/input/inputaction.h +++ b/src/input/inputaction.h @@ -508,6 +508,7 @@ namespace InputAction INV_TO_STORAGE, INV_TO_STORAGE_10, INV_TO_STORAGE_HALF, + INV_TO_STORAGE_ALL_1, TOTAL }; } // namespace InputAction diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index 03a199e38..f8427e397 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -4315,6 +4315,15 @@ static const InputActionData inputActionData[InputAction::TOTAL] = { InputCondition::INGAME, "invtostoragehalf|invstoragehalf", true}, + {"keyInvToStorageAll1", + InputType::UNKNOWN, InputAction::NO_VALUE, + InputType::UNKNOWN, InputAction::NO_VALUE, + Input::GRP_DEFAULT, + &Actions::invToStorageAll1, + InputAction::NO_VALUE, 50, + InputCondition::INGAME, + "invtostorageall1|invstorageall1", + true}, }; #endif // INPUT_INPUTACTIONMAP_H |