{"action":"created","comment":{"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/comments/33877600","id":33877600,"diff_hunk":"@@ -1724,60 +1748,70 @@ bool advanced_inventory::query_destination( aim_location &def )\n     if( menu.ret >= AIM_SOUTHWEST && menu.ret <= AIM_NORTHEAST ) {\n         assert( squares[menu.ret].canputitems() );\n         def = static_cast<aim_location>( menu.ret );\n+        panes[dest].set_area(squares[def], true);\n         uistate.adv_inv_last_popup_dest = menu.ret;\n         return true;\n     }\n     return false;\n }\n \n-void advanced_inventory::remove_item( advanced_inv_listitem &sitem )\n+// TODO: change `*.front()' to loop index based on `count'\n+void advanced_inventory::remove_item( advanced_inv_listitem &sitem, int count )\n {\n     assert( sitem.area != AIM_ALL );        // should be a specific location instead\n     assert( sitem.area != AIM_INVENTORY );  // does not work for inventory\n-    assert( sitem.area != AIM_WORN );       // yeah what he said\n-    assert( sitem.it != nullptr );\n-    bool rc = false;\n-\n-    auto &s = squares[sitem.area];\n-    if( s.id == AIM_CONTAINER ) {\n-        const auto cont = s.get_container( panes[src].in_vehicle() );\n-        assert( cont != nullptr );\n-        assert( !cont->contents.empty() );\n-        assert( &cont->contents.front() == sitem.it );\n-        cont->contents.erase( cont->contents.begin() );\n-        rc = true;\n-    } else if( sitem.area == AIM_WORN ) {\n-        rc = g->u.takeoff( sitem.it );\n-    } else if( sitem.from_vehicle ) {\n-        rc = s.veh->remove_item( s.vstor, sitem.it );\n-    }\n-\n-    if( !rc ) {\n-        // TODO: Make this print an error if it fails\n-        g->m.i_rem( s.pos, sitem.it );\n+    assert( !sitem.items.empty() );\n+    bool rc = true;\n+\n+    while(count > 0) {\n+        auto &s = squares[sitem.area];\n+        if( s.id == AIM_CONTAINER ) {\n+            const auto cont = s.get_container( panes[src].in_vehicle() );\n+            assert( cont != nullptr );\n+            assert( !cont->contents.empty() );\n+            assert( &cont->contents.front() == sitem.items.front() );\n+            cont->contents.erase( cont->contents.begin() );\n+        } else if( sitem.area == AIM_WORN ) {\n+            rc &= g->u.takeoff( sitem.items.front() );\n+        } else if( sitem.from_vehicle ) {\n+            rc &= s.veh->remove_item( s.vstor, sitem.items.front() );\n+        } else {\n+            g->m.i_rem( s.pos, sitem.items.front() );\n+        }\n+        if(rc == false) {\n+            break;\n+        }\n+        sitem.items.erase(sitem.items.begin());\n+        --count;\n     }\n }\n \n-bool advanced_inventory::add_item( aim_location destarea, item &new_item )\n+bool advanced_inventory::add_item( aim_location destarea, item &new_item, int count )\n {\n     assert( destarea != AIM_ALL ); // should be a specific location instead\n     bool rc = true;\n-    if( destarea == AIM_INVENTORY ) {\n-        g->u.i_add( new_item );\n-        g->u.moves -= 100;\n-        return rc;\n-    } else if( destarea == AIM_WORN ) {\n-        return g->u.wear_item(&new_item);\n-    } else {\n-        advanced_inv_area &p = squares[destarea];\n-        if( panes[dest].in_vehicle() ) {\n-            rc = p.veh->add_item( p.vstor, new_item );\n+\n+    while(count > 0) {\n+        if( destarea == AIM_INVENTORY ) {\n+            auto it = g->u.i_add( new_item );\n+            g->u.moves -= 100;\n+            rc = it.type->id == new_item.type->id;","path":"src/advanced_inv.cpp","position":650,"original_position":507,"commit_id":"703c3fa66d642d614368439d9402307ce66bcde5","original_commit_id":"cbea85b2335c5c16f6c40f899c31d8a86783ebba","user":{"login":"DavidKeaton","id":1715605,"avatar_url":"https://avatars.githubusercontent.com/u/1715605?v=3","gravatar_id":"","url":"https://api.github.com/users/DavidKeaton","html_url":"https://github.com/DavidKeaton","followers_url":"https://api.github.com/users/DavidKeaton/followers","following_url":"https://api.github.com/users/DavidKeaton/following{/other_user}","gists_url":"https://api.github.com/users/DavidKeaton/gists{/gist_id}","starred_url":"https://api.github.com/users/DavidKeaton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DavidKeaton/subscriptions","organizations_url":"https://api.github.com/users/DavidKeaton/orgs","repos_url":"https://api.github.com/users/DavidKeaton/repos","events_url":"https://api.github.com/users/DavidKeaton/events{/privacy}","received_events_url":"https://api.github.com/users/DavidKeaton/received_events","type":"User","site_admin":false},"body":"I overlooked this comment, my bad. I wasn't sure what I wanted to do at the time, and figured making the id check was adequate, but adding an item shouldn't fail, so I removed it completely.","created_at":"2015-07-03T18:50:35Z","updated_at":"2015-07-03T18:50:35Z","html_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/12566#discussion_r33877600","pull_request_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/12566","_links":{"self":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/comments/33877600"},"html":{"href":"https://github.com/CleverRaven/Cataclysm-DDA/pull/12566#discussion_r33877600"},"pull_request":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/12566"}}},"pull_request":{"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/12566","id":37099980,"html_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/12566","diff_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/12566.diff","patch_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/12566.patch","issue_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/12566","number":12566,"state":"open","locked":false,"title":"[RDY] AIM Updates","user":{"login":"DavidKeaton","id":1715605,"avatar_url":"https://avatars.githubusercontent.com/u/1715605?v=3","gravatar_id":"","url":"https://api.github.com/users/DavidKeaton","html_url":"https://github.com/DavidKeaton","followers_url":"https://api.github.com/users/DavidKeaton/followers","following_url":"https://api.github.com/users/DavidKeaton/following{/other_user}","gists_url":"https://api.github.com/users/DavidKeaton/gists{/gist_id}","starred_url":"https://api.github.com/users/DavidKeaton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DavidKeaton/subscriptions","organizations_url":"https://api.github.com/users/DavidKeaton/orgs","repos_url":"https://api.github.com/users/DavidKeaton/repos","events_url":"https://api.github.com/users/DavidKeaton/events{/privacy}","received_events_url":"https://api.github.com/users/DavidKeaton/received_events","type":"User","site_admin":false},"body":"- When using the `AIM_ALL` directional menu to place an item, it now defaults to placing in a vehicle storage.\r\n- When selecting said tile, it is now the tile displayed for `panes[dest]` when finished.\r\n- Fixes #12542\r\n- Fixed loading settings for panes.\r\n- Loading AIM now respects whether the pane was in or out of vehicle now.\r\n- Now, you can move either one item of a stack at a time, X amount at a time, or _all_ at a time. You can even do this from **all** areas!\r\n- Stack movement now respects `charges`!\r\n- The popup for `MOVE_VARIABLE_ITEM` now automatically enters _no_ number. I have gotten differing requests on the number to start with, so decided to remove the number altogether! Take that, suggestions!\r\n- Removed `is_any_of()` in `enums.h`, and used `std::any_of()` instead.\r\n- You can now use `AIM_ALL` as a source pane and use `MOVE_ALL_ITEMS`!!! So now, just as @Coolthulhu had suggested ever so long ago, you can move everything into a neat little pile! :-D\r\n- A fun little story! :-)\r\n\r\nhth!\r\n-Davek","created_at":"2015-06-07T02:06:14Z","updated_at":"2015-07-03T18:50:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"60ce3db21cd43892d61f08e8555ebd557c738a90","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/12566/commits","review_comments_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/12566/comments","review_comment_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/12566/comments","statuses_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/statuses/703c3fa66d642d614368439d9402307ce66bcde5","head":{"label":"DavidKeaton:aim","ref":"aim","sha":"703c3fa66d642d614368439d9402307ce66bcde5","user":{"login":"DavidKeaton","id":1715605,"avatar_url":"https://avatars.githubusercontent.com/u/1715605?v=3","gravatar_id":"","url":"https://api.github.com/users/DavidKeaton","html_url":"https://github.com/DavidKeaton","followers_url":"https://api.github.com/users/DavidKeaton/followers","following_url":"https://api.github.com/users/DavidKeaton/following{/other_user}","gists_url":"https://api.github.com/users/DavidKeaton/gists{/gist_id}","starred_url":"https://api.github.com/users/DavidKeaton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DavidKeaton/subscriptions","organizations_url":"https://api.github.com/users/DavidKeaton/orgs","repos_url":"https://api.github.com/users/DavidKeaton/repos","events_url":"https://api.github.com/users/DavidKeaton/events{/privacy}","received_events_url":"https://api.github.com/users/DavidKeaton/received_events","type":"User","site_admin":false},"repo":{"id":24438862,"name":"Cataclysm-DDA","full_name":"DavidKeaton/Cataclysm-DDA","owner":{"login":"DavidKeaton","id":1715605,"avatar_url":"https://avatars.githubusercontent.com/u/1715605?v=3","gravatar_id":"","url":"https://api.github.com/users/DavidKeaton","html_url":"https://github.com/DavidKeaton","followers_url":"https://api.github.com/users/DavidKeaton/followers","following_url":"https://api.github.com/users/DavidKeaton/following{/other_user}","gists_url":"https://api.github.com/users/DavidKeaton/gists{/gist_id}","starred_url":"https://api.github.com/users/DavidKeaton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DavidKeaton/subscriptions","organizations_url":"https://api.github.com/users/DavidKeaton/orgs","repos_url":"https://api.github.com/users/DavidKeaton/repos","events_url":"https://api.github.com/users/DavidKeaton/events{/privacy}","received_events_url":"https://api.github.com/users/DavidKeaton/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/DavidKeaton/Cataclysm-DDA","description":"Cataclysm - Dark Days Ahead. A fork/variant of Cataclysm Roguelike by Whales.","fork":true,"url":"https://api.github.com/repos/DavidKeaton/Cataclysm-DDA","forks_url":"https://api.github.com/repos/DavidKeaton/Cataclysm-DDA/forks","keys_url":"https://api.github.com/repos/DavidKeaton/Cataclysm-DDA/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DavidKeaton/Cataclysm-DDA/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DavidKeaton/Cataclysm-DDA/teams","hooks_url":"https://api.github.com/repos/DavidKeaton/Cataclysm-DDA/hooks","issue_events_url":"https://api.github.com/repos/DavidKeaton/Cataclysm-DDA/issues/events{/number}","events_url":"https://api.github.com/repos/DavidKeaton/Cataclysm-DDA/events","assignees_url":"https://api.github.com/repos/DavidKeaton/Cataclysm-DDA/assignees{/user}","branches_url":"https://api.github.com/repos/DavidKeaton/Cataclysm-DDA/branches{/branch}","tags_url":"https://api.github.com/repos/DavidKeaton/Cataclysm-DDA/tags","blobs_url":"https://api.github.com/repos/DavidKeaton/Cataclysm-DDA/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DavidKeaton/Cataclysm-DDA/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DavidKeaton/Cataclysm-DDA/git/refs{/sha}","trees_url":"https://api.github.com/repos/DavidKeaton/Cataclysm-DDA/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DavidKeaton/Cataclysm-DDA/statuses/{sha}","languages_url":"https://api.github.com/repos/DavidKeaton/Cataclysm-DDA/languages","stargazers_url":"https://api.github.com/repos/DavidKeaton/Cataclysm-DDA/stargazers","contributors_url":"https://api.github.com/repos/DavidKeaton/Cataclysm-DDA/contributors","subscribers_url":"https://api.github.com/repos/DavidKeaton/Cataclysm-DDA/subscribers","subscription_url":"https://api.github.com/repos/DavidKeaton/Cataclysm-DDA/subscription","commits_url":"https://api.github.com/repos/DavidKeaton/Cataclysm-DDA/commits{/sha}","git_commits_url":"https://api.github.com/repos/DavidKeaton/Cataclysm-DDA/git/commits{/sha}","comments_url":"https://api.github.com/repos/DavidKeaton/Cataclysm-DDA/comments{/number}","issue_comment_url":"https://api.github.com/repos/DavidKeaton/Cataclysm-DDA/issues/comments{/number}","contents_url":"https://api.github.com/repos/DavidKeaton/Cataclysm-DDA/contents/{+path}","compare_url":"https://api.github.com/repos/DavidKeaton/Cataclysm-DDA/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DavidKeaton/Cataclysm-DDA/merges","archive_url":"https://api.github.com/repos/DavidKeaton/Cataclysm-DDA/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DavidKeaton/Cataclysm-DDA/downloads","issues_url":"https://api.github.com/repos/DavidKeaton/Cataclysm-DDA/issues{/number}","pulls_url":"https://api.github.com/repos/DavidKeaton/Cataclysm-DDA/pulls{/number}","milestones_url":"https://api.github.com/repos/DavidKeaton/Cataclysm-DDA/milestones{/number}","notifications_url":"https://api.github.com/repos/DavidKeaton/Cataclysm-DDA/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DavidKeaton/Cataclysm-DDA/labels{/name}","releases_url":"https://api.github.com/repos/DavidKeaton/Cataclysm-DDA/releases{/id}","created_at":"2014-09-25T01:24:24Z","updated_at":"2015-04-28T04:08:24Z","pushed_at":"2015-06-28T15:56:03Z","git_url":"git://github.com/DavidKeaton/Cataclysm-DDA.git","ssh_url":"git@github.com:DavidKeaton/Cataclysm-DDA.git","clone_url":"https://github.com/DavidKeaton/Cataclysm-DDA.git","svn_url":"https://github.com/DavidKeaton/Cataclysm-DDA","homepage":"http://en.cataclysmdda.com/","size":473979,"stargazers_count":1,"watchers_count":1,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"CleverRaven:master","ref":"master","sha":"f9144d4821c6a7200da1fc72a3b55f60a5f9a9ca","user":{"login":"CleverRaven","id":4367009,"avatar_url":"https://avatars.githubusercontent.com/u/4367009?v=3","gravatar_id":"","url":"https://api.github.com/users/CleverRaven","html_url":"https://github.com/CleverRaven","followers_url":"https://api.github.com/users/CleverRaven/followers","following_url":"https://api.github.com/users/CleverRaven/following{/other_user}","gists_url":"https://api.github.com/users/CleverRaven/gists{/gist_id}","starred_url":"https://api.github.com/users/CleverRaven/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CleverRaven/subscriptions","organizations_url":"https://api.github.com/users/CleverRaven/orgs","repos_url":"https://api.github.com/users/CleverRaven/repos","events_url":"https://api.github.com/users/CleverRaven/events{/privacy}","received_events_url":"https://api.github.com/users/CleverRaven/received_events","type":"Organization","site_admin":false},"repo":{"id":5973855,"name":"Cataclysm-DDA","full_name":"CleverRaven/Cataclysm-DDA","owner":{"login":"CleverRaven","id":4367009,"avatar_url":"https://avatars.githubusercontent.com/u/4367009?v=3","gravatar_id":"","url":"https://api.github.com/users/CleverRaven","html_url":"https://github.com/CleverRaven","followers_url":"https://api.github.com/users/CleverRaven/followers","following_url":"https://api.github.com/users/CleverRaven/following{/other_user}","gists_url":"https://api.github.com/users/CleverRaven/gists{/gist_id}","starred_url":"https://api.github.com/users/CleverRaven/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CleverRaven/subscriptions","organizations_url":"https://api.github.com/users/CleverRaven/orgs","repos_url":"https://api.github.com/users/CleverRaven/repos","events_url":"https://api.github.com/users/CleverRaven/events{/privacy}","received_events_url":"https://api.github.com/users/CleverRaven/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CleverRaven/Cataclysm-DDA","description":"Cataclysm - Dark Days Ahead. A fork/variant of Cataclysm Roguelike by Whales.","fork":false,"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA","forks_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/forks","keys_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/teams","hooks_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/hooks","issue_events_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/events{/number}","events_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/events","assignees_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/assignees{/user}","branches_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/branches{/branch}","tags_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/tags","blobs_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/git/refs{/sha}","trees_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/statuses/{sha}","languages_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/languages","stargazers_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/stargazers","contributors_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/contributors","subscribers_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/subscribers","subscription_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/subscription","commits_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/commits{/sha}","git_commits_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/git/commits{/sha}","comments_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/comments{/number}","issue_comment_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/comments{/number}","contents_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/contents/{+path}","compare_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/merges","archive_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/downloads","issues_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues{/number}","pulls_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls{/number}","milestones_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/milestones{/number}","notifications_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/labels{/name}","releases_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/releases{/id}","created_at":"2012-09-26T22:57:43Z","updated_at":"2015-06-27T16:27:57Z","pushed_at":"2015-07-03T18:34:41Z","git_url":"git://github.com/CleverRaven/Cataclysm-DDA.git","ssh_url":"git@github.com:CleverRaven/Cataclysm-DDA.git","clone_url":"https://github.com/CleverRaven/Cataclysm-DDA.git","svn_url":"https://github.com/CleverRaven/Cataclysm-DDA","homepage":"http://en.cataclysmdda.com/","size":554615,"stargazers_count":691,"watchers_count":691,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":730,"mirror_url":null,"open_issues_count":1004,"forks":730,"open_issues":1004,"watchers":691,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/12566"},"html":{"href":"https://github.com/CleverRaven/Cataclysm-DDA/pull/12566"},"issue":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/12566"},"comments":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/12566/comments"},"review_comments":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/12566/comments"},"review_comment":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/12566/commits"},"statuses":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/statuses/703c3fa66d642d614368439d9402307ce66bcde5"}}}}