{"action":"created","comment":{"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/comments/24062943","id":24062943,"diff_hunk":"@@ -3137,35 +3137,44 @@ void map::process_items( bool active, T processor, std::string signal )\n }\n \n template<typename T>\n-void map::process_items_in_submap( submap *const current_submap, int gridx, int gridy, T processor,\n-                                   std::string signal )\n+void map::process_items_in_submap( submap *const current_submap, int const gridx, int const gridy,\n+    T processor, std::string const &signal )\n {\n     // Get a COPY of the active item list for this submap.\n     // If more are added as a side effect of processing, they are ignored this turn.\n     // If they are destroyed before processing, they don't get processed.\n     std::list<item_reference> active_items = current_submap->active_items.get();\n+    auto const p0 = point {gridx * SEEX, gridy * SEEY};\n     for( auto &active_item : active_items ) {\n-        point map_location( gridx * SEEX + active_item.location.x,\n-                            gridy * SEEY + active_item.location.y );\n-        auto items = i_at( map_location.x, map_location.y );\n         if( !current_submap->active_items.has( active_item ) ) {\n             continue;\n         }\n-        processor( items, active_item.item_iterator, map_location, signal );\n+\n+        auto const p = p0 + active_item.location; //map location\n+        processor( i_at( p.x, p.y ), active_item.item_iterator, p, signal );\n     }\n }\n \n+namespace {","path":"src/map.cpp","position":null,"original_position":47,"commit_id":"5633a1e23d120453f632253221e55dba633c4184","original_commit_id":"5e4e01beb873dafcfabea2cd3f2da00a734ac85a","user":{"login":"kevingranade","id":860276,"avatar_url":"https://avatars.githubusercontent.com/u/860276?v=3","gravatar_id":"","url":"https://api.github.com/users/kevingranade","html_url":"https://github.com/kevingranade","followers_url":"https://api.github.com/users/kevingranade/followers","following_url":"https://api.github.com/users/kevingranade/following{/other_user}","gists_url":"https://api.github.com/users/kevingranade/gists{/gist_id}","starred_url":"https://api.github.com/users/kevingranade/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kevingranade/subscriptions","organizations_url":"https://api.github.com/users/kevingranade/orgs","repos_url":"https://api.github.com/users/kevingranade/repos","events_url":"https://api.github.com/users/kevingranade/events{/privacy}","received_events_url":"https://api.github.com/users/kevingranade/received_events","type":"User","site_admin":false},"body":"This is unnecessary, you're reimplementing std::find() here.","created_at":"2015-02-04T05:03:08Z","updated_at":"2015-02-04T05:03:08Z","html_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/11118#discussion_r24062943","pull_request_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/11118","_links":{"self":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/comments/24062943"},"html":{"href":"https://github.com/CleverRaven/Cataclysm-DDA/pull/11118#discussion_r24062943"},"pull_request":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/11118"}}},"pull_request":{"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/11118","id":28612443,"html_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/11118","diff_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/11118.diff","patch_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/11118.patch","issue_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/11118","number":11118,"state":"open","locked":false,"title":"Process items tweak","user":{"login":"bkentel","id":780369,"avatar_url":"https://avatars.githubusercontent.com/u/780369?v=3","gravatar_id":"","url":"https://api.github.com/users/bkentel","html_url":"https://github.com/bkentel","followers_url":"https://api.github.com/users/bkentel/followers","following_url":"https://api.github.com/users/bkentel/following{/other_user}","gists_url":"https://api.github.com/users/bkentel/gists{/gist_id}","starred_url":"https://api.github.com/users/bkentel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bkentel/subscriptions","organizations_url":"https://api.github.com/users/bkentel/orgs","repos_url":"https://api.github.com/users/bkentel/repos","events_url":"https://api.github.com/users/bkentel/events{/privacy}","received_events_url":"https://api.github.com/users/bkentel/received_events","type":"User","site_admin":false},"body":"I was investigating #11108 and noticed a few simple tweaks that could be made (the small net gain in lines is due to extra whitespace).\r\n+ use algorithms\r\n+ apply const correctly\r\n+ eliminate uninitialized variables\r\n+ re-order / add checks to avoid unnecessary work.\r\n","created_at":"2015-02-04T04:19:27Z","updated_at":"2015-02-04T05:03:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3ca343319d1231e2638f7889dd70356f8561a6c9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/11118/commits","review_comments_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/11118/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/11118/comments","statuses_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/statuses/5633a1e23d120453f632253221e55dba633c4184","head":{"label":"bkentel:process-items-tweak","ref":"process-items-tweak","sha":"5633a1e23d120453f632253221e55dba633c4184","user":{"login":"bkentel","id":780369,"avatar_url":"https://avatars.githubusercontent.com/u/780369?v=3","gravatar_id":"","url":"https://api.github.com/users/bkentel","html_url":"https://github.com/bkentel","followers_url":"https://api.github.com/users/bkentel/followers","following_url":"https://api.github.com/users/bkentel/following{/other_user}","gists_url":"https://api.github.com/users/bkentel/gists{/gist_id}","starred_url":"https://api.github.com/users/bkentel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bkentel/subscriptions","organizations_url":"https://api.github.com/users/bkentel/orgs","repos_url":"https://api.github.com/users/bkentel/repos","events_url":"https://api.github.com/users/bkentel/events{/privacy}","received_events_url":"https://api.github.com/users/bkentel/received_events","type":"User","site_admin":false},"repo":{"id":28679284,"name":"Cataclysm-DDA","full_name":"bkentel/Cataclysm-DDA","owner":{"login":"bkentel","id":780369,"avatar_url":"https://avatars.githubusercontent.com/u/780369?v=3","gravatar_id":"","url":"https://api.github.com/users/bkentel","html_url":"https://github.com/bkentel","followers_url":"https://api.github.com/users/bkentel/followers","following_url":"https://api.github.com/users/bkentel/following{/other_user}","gists_url":"https://api.github.com/users/bkentel/gists{/gist_id}","starred_url":"https://api.github.com/users/bkentel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bkentel/subscriptions","organizations_url":"https://api.github.com/users/bkentel/orgs","repos_url":"https://api.github.com/users/bkentel/repos","events_url":"https://api.github.com/users/bkentel/events{/privacy}","received_events_url":"https://api.github.com/users/bkentel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bkentel/Cataclysm-DDA","description":"Cataclysm - Dark Days Ahead. A fork/variant of Cataclysm Roguelike by Whales.","fork":true,"url":"https://api.github.com/repos/bkentel/Cataclysm-DDA","forks_url":"https://api.github.com/repos/bkentel/Cataclysm-DDA/forks","keys_url":"https://api.github.com/repos/bkentel/Cataclysm-DDA/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bkentel/Cataclysm-DDA/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bkentel/Cataclysm-DDA/teams","hooks_url":"https://api.github.com/repos/bkentel/Cataclysm-DDA/hooks","issue_events_url":"https://api.github.com/repos/bkentel/Cataclysm-DDA/issues/events{/number}","events_url":"https://api.github.com/repos/bkentel/Cataclysm-DDA/events","assignees_url":"https://api.github.com/repos/bkentel/Cataclysm-DDA/assignees{/user}","branches_url":"https://api.github.com/repos/bkentel/Cataclysm-DDA/branches{/branch}","tags_url":"https://api.github.com/repos/bkentel/Cataclysm-DDA/tags","blobs_url":"https://api.github.com/repos/bkentel/Cataclysm-DDA/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bkentel/Cataclysm-DDA/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bkentel/Cataclysm-DDA/git/refs{/sha}","trees_url":"https://api.github.com/repos/bkentel/Cataclysm-DDA/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bkentel/Cataclysm-DDA/statuses/{sha}","languages_url":"https://api.github.com/repos/bkentel/Cataclysm-DDA/languages","stargazers_url":"https://api.github.com/repos/bkentel/Cataclysm-DDA/stargazers","contributors_url":"https://api.github.com/repos/bkentel/Cataclysm-DDA/contributors","subscribers_url":"https://api.github.com/repos/bkentel/Cataclysm-DDA/subscribers","subscription_url":"https://api.github.com/repos/bkentel/Cataclysm-DDA/subscription","commits_url":"https://api.github.com/repos/bkentel/Cataclysm-DDA/commits{/sha}","git_commits_url":"https://api.github.com/repos/bkentel/Cataclysm-DDA/git/commits{/sha}","comments_url":"https://api.github.com/repos/bkentel/Cataclysm-DDA/comments{/number}","issue_comment_url":"https://api.github.com/repos/bkentel/Cataclysm-DDA/issues/comments/{number}","contents_url":"https://api.github.com/repos/bkentel/Cataclysm-DDA/contents/{+path}","compare_url":"https://api.github.com/repos/bkentel/Cataclysm-DDA/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bkentel/Cataclysm-DDA/merges","archive_url":"https://api.github.com/repos/bkentel/Cataclysm-DDA/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bkentel/Cataclysm-DDA/downloads","issues_url":"https://api.github.com/repos/bkentel/Cataclysm-DDA/issues{/number}","pulls_url":"https://api.github.com/repos/bkentel/Cataclysm-DDA/pulls{/number}","milestones_url":"https://api.github.com/repos/bkentel/Cataclysm-DDA/milestones{/number}","notifications_url":"https://api.github.com/repos/bkentel/Cataclysm-DDA/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bkentel/Cataclysm-DDA/labels{/name}","releases_url":"https://api.github.com/repos/bkentel/Cataclysm-DDA/releases{/id}","created_at":"2015-01-01T02:36:43Z","updated_at":"2015-02-03T12:03:03Z","pushed_at":"2015-02-04T04:58:30Z","git_url":"git://github.com/bkentel/Cataclysm-DDA.git","ssh_url":"git@github.com:bkentel/Cataclysm-DDA.git","clone_url":"https://github.com/bkentel/Cataclysm-DDA.git","svn_url":"https://github.com/bkentel/Cataclysm-DDA","homepage":"http://en.cataclysmdda.com/","size":349604,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"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":0,"default_branch":"master"}},"base":{"label":"CleverRaven:master","ref":"master","sha":"ea2185f97054ba7e1760650cb3a027e9582851e5","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-02-04T04:55:55Z","pushed_at":"2015-02-04T04:55:55Z","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":420944,"stargazers_count":591,"watchers_count":591,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":645,"mirror_url":null,"open_issues_count":808,"forks":645,"open_issues":808,"watchers":591,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/11118"},"html":{"href":"https://github.com/CleverRaven/Cataclysm-DDA/pull/11118"},"issue":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/11118"},"comments":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/11118/comments"},"review_comments":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/11118/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/11118/commits"},"statuses":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/statuses/5633a1e23d120453f632253221e55dba633c4184"}}}}