{"action":"created","comment":{"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/comments/37976604","id":37976604,"diff_hunk":"@@ -1503,8 +1531,58 @@ int set_scenario(WINDOW *w, player *u, int &points)\n     ctxt.register_action(\"NEXT_TAB\");\n     ctxt.register_action(\"SORT\");\n     ctxt.register_action(\"HELP_KEYBINDINGS\");\n+    ctxt.register_action(\"FILTER\");\n+\n+    bool recalc_scens = true;\n+    int scens_length;\n+    std::string filterstring = \"\";\n+    std::vector<const scenario *> sorted_scens;\n \n     do {\n+        if (recalc_scens) {\n+            sorted_scens.clear();\n+            for (scenmap::const_iterator iter = scenario::begin(); iter != scenario::end(); ++iter) {\n+                if (!filterstring.empty()) {\n+                    if (!lcmatch(iter->second.gender_appropriate_name(u->male), filterstring)) {\n+                        continue;\n+                    }\n+                }\n+                sorted_scens.push_back(&(iter->second));\n+            }\n+            scens_length = sorted_scens.size();\n+            if (scens_length == 0) {\n+                popup(_(\"Nothing found.\")); // another case of black box in tiles\n+                filterstring.clear();","path":"src/newcharacter.cpp","position":213,"original_position":216,"commit_id":"f0f0be7078b71eb6520277331249e52a2befb864","original_commit_id":"8ba9fd6a253e74908e0529df6d0343ea0244ddff","user":{"login":"drbig","id":1252899,"avatar_url":"https://avatars.githubusercontent.com/u/1252899?v=3","gravatar_id":"","url":"https://api.github.com/users/drbig","html_url":"https://github.com/drbig","followers_url":"https://api.github.com/users/drbig/followers","following_url":"https://api.github.com/users/drbig/following{/other_user}","gists_url":"https://api.github.com/users/drbig/gists{/gist_id}","starred_url":"https://api.github.com/users/drbig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drbig/subscriptions","organizations_url":"https://api.github.com/users/drbig/orgs","repos_url":"https://api.github.com/users/drbig/repos","events_url":"https://api.github.com/users/drbig/events{/privacy}","received_events_url":"https://api.github.com/users/drbig/received_events","type":"User","site_admin":false},"body":"> The wish item, spawn monster and toggle mutations debug things are implemented using the uimenu.\r\n\r\n> One would probably need some adjustments for special filters (the menu only filters based on the displayed text). And sorting is not supported. And you might need to add code to prevent the border.\r\n\r\nI think it would be interesting to add sorting and custom (callback based perhaps?) filters to `uimenu`. We could then do a sweep and replace as many ad-hoc local solutions with it. This does sound sane indeed.","created_at":"2015-08-26T12:45:35Z","updated_at":"2015-08-26T12:45:35Z","html_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/13413#discussion_r37976604","pull_request_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/13413","_links":{"self":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/comments/37976604"},"html":{"href":"https://github.com/CleverRaven/Cataclysm-DDA/pull/13413#discussion_r37976604"},"pull_request":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/13413"}}},"pull_request":{"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/13413","id":43296722,"html_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/13413","diff_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/13413.diff","patch_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/13413.patch","issue_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/13413","number":13413,"state":"open","locked":false,"title":"Add basic filters for scenario and profession","user":{"login":"drbig","id":1252899,"avatar_url":"https://avatars.githubusercontent.com/u/1252899?v=3","gravatar_id":"","url":"https://api.github.com/users/drbig","html_url":"https://github.com/drbig","followers_url":"https://api.github.com/users/drbig/followers","following_url":"https://api.github.com/users/drbig/following{/other_user}","gists_url":"https://api.github.com/users/drbig/gists{/gist_id}","starred_url":"https://api.github.com/users/drbig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drbig/subscriptions","organizations_url":"https://api.github.com/users/drbig/orgs","repos_url":"https://api.github.com/users/drbig/repos","events_url":"https://api.github.com/users/drbig/events{/privacy}","received_events_url":"https://api.github.com/users/drbig/received_events","type":"User","site_admin":false},"body":"Addresses #13393.\r\n\r\nWould like to first get this in and get it tested. Adding special filters could be a next step and a separate PR. I think it needs to show somewhere in the UI that there are filters now, hence the \"filter indicator\". Switched sorting to use the whole recalc code so the selection gets preserved (felt like factoring this out would make it less clear for no real benefit).\r\n\r\nPlease apply code-review stick generously.","created_at":"2015-08-25T15:03:07Z","updated_at":"2015-08-26T12:45:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"25f7ea39216d3ffee6c84c3dffee6b4820b60156","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/13413/commits","review_comments_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/13413/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/13413/comments","statuses_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/statuses/f0f0be7078b71eb6520277331249e52a2befb864","head":{"label":"drbig:chargen-filters","ref":"chargen-filters","sha":"f0f0be7078b71eb6520277331249e52a2befb864","user":{"login":"drbig","id":1252899,"avatar_url":"https://avatars.githubusercontent.com/u/1252899?v=3","gravatar_id":"","url":"https://api.github.com/users/drbig","html_url":"https://github.com/drbig","followers_url":"https://api.github.com/users/drbig/followers","following_url":"https://api.github.com/users/drbig/following{/other_user}","gists_url":"https://api.github.com/users/drbig/gists{/gist_id}","starred_url":"https://api.github.com/users/drbig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drbig/subscriptions","organizations_url":"https://api.github.com/users/drbig/orgs","repos_url":"https://api.github.com/users/drbig/repos","events_url":"https://api.github.com/users/drbig/events{/privacy}","received_events_url":"https://api.github.com/users/drbig/received_events","type":"User","site_admin":false},"repo":{"id":24682768,"name":"Cataclysm-DDA","full_name":"drbig/Cataclysm-DDA","owner":{"login":"drbig","id":1252899,"avatar_url":"https://avatars.githubusercontent.com/u/1252899?v=3","gravatar_id":"","url":"https://api.github.com/users/drbig","html_url":"https://github.com/drbig","followers_url":"https://api.github.com/users/drbig/followers","following_url":"https://api.github.com/users/drbig/following{/other_user}","gists_url":"https://api.github.com/users/drbig/gists{/gist_id}","starred_url":"https://api.github.com/users/drbig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drbig/subscriptions","organizations_url":"https://api.github.com/users/drbig/orgs","repos_url":"https://api.github.com/users/drbig/repos","events_url":"https://api.github.com/users/drbig/events{/privacy}","received_events_url":"https://api.github.com/users/drbig/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/drbig/Cataclysm-DDA","description":"Cataclysm - Dark Days Ahead. A fork/variant of Cataclysm Roguelike by Whales.","fork":true,"url":"https://api.github.com/repos/drbig/Cataclysm-DDA","forks_url":"https://api.github.com/repos/drbig/Cataclysm-DDA/forks","keys_url":"https://api.github.com/repos/drbig/Cataclysm-DDA/keys{/key_id}","collaborators_url":"https://api.github.com/repos/drbig/Cataclysm-DDA/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/drbig/Cataclysm-DDA/teams","hooks_url":"https://api.github.com/repos/drbig/Cataclysm-DDA/hooks","issue_events_url":"https://api.github.com/repos/drbig/Cataclysm-DDA/issues/events{/number}","events_url":"https://api.github.com/repos/drbig/Cataclysm-DDA/events","assignees_url":"https://api.github.com/repos/drbig/Cataclysm-DDA/assignees{/user}","branches_url":"https://api.github.com/repos/drbig/Cataclysm-DDA/branches{/branch}","tags_url":"https://api.github.com/repos/drbig/Cataclysm-DDA/tags","blobs_url":"https://api.github.com/repos/drbig/Cataclysm-DDA/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/drbig/Cataclysm-DDA/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/drbig/Cataclysm-DDA/git/refs{/sha}","trees_url":"https://api.github.com/repos/drbig/Cataclysm-DDA/git/trees{/sha}","statuses_url":"https://api.github.com/repos/drbig/Cataclysm-DDA/statuses/{sha}","languages_url":"https://api.github.com/repos/drbig/Cataclysm-DDA/languages","stargazers_url":"https://api.github.com/repos/drbig/Cataclysm-DDA/stargazers","contributors_url":"https://api.github.com/repos/drbig/Cataclysm-DDA/contributors","subscribers_url":"https://api.github.com/repos/drbig/Cataclysm-DDA/subscribers","subscription_url":"https://api.github.com/repos/drbig/Cataclysm-DDA/subscription","commits_url":"https://api.github.com/repos/drbig/Cataclysm-DDA/commits{/sha}","git_commits_url":"https://api.github.com/repos/drbig/Cataclysm-DDA/git/commits{/sha}","comments_url":"https://api.github.com/repos/drbig/Cataclysm-DDA/comments{/number}","issue_comment_url":"https://api.github.com/repos/drbig/Cataclysm-DDA/issues/comments{/number}","contents_url":"https://api.github.com/repos/drbig/Cataclysm-DDA/contents/{+path}","compare_url":"https://api.github.com/repos/drbig/Cataclysm-DDA/compare/{base}...{head}","merges_url":"https://api.github.com/repos/drbig/Cataclysm-DDA/merges","archive_url":"https://api.github.com/repos/drbig/Cataclysm-DDA/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/drbig/Cataclysm-DDA/downloads","issues_url":"https://api.github.com/repos/drbig/Cataclysm-DDA/issues{/number}","pulls_url":"https://api.github.com/repos/drbig/Cataclysm-DDA/pulls{/number}","milestones_url":"https://api.github.com/repos/drbig/Cataclysm-DDA/milestones{/number}","notifications_url":"https://api.github.com/repos/drbig/Cataclysm-DDA/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/drbig/Cataclysm-DDA/labels{/name}","releases_url":"https://api.github.com/repos/drbig/Cataclysm-DDA/releases{/id}","created_at":"2014-10-01T15:01:33Z","updated_at":"2015-04-02T18:35:11Z","pushed_at":"2015-08-25T17:03:28Z","git_url":"git://github.com/drbig/Cataclysm-DDA.git","ssh_url":"git@github.com:drbig/Cataclysm-DDA.git","clone_url":"https://github.com/drbig/Cataclysm-DDA.git","svn_url":"https://github.com/drbig/Cataclysm-DDA","homepage":"http://en.cataclysmdda.com/","size":502720,"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":"97b13ff2de67d22ee3cd6f600ea05564edbab359","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-08-23T16:56:36Z","pushed_at":"2015-08-26T10:38:46Z","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":800366,"stargazers_count":723,"watchers_count":723,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":759,"mirror_url":null,"open_issues_count":1060,"forks":759,"open_issues":1060,"watchers":723,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/13413"},"html":{"href":"https://github.com/CleverRaven/Cataclysm-DDA/pull/13413"},"issue":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/13413"},"comments":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/13413/comments"},"review_comments":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/13413/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/13413/commits"},"statuses":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/statuses/f0f0be7078b71eb6520277331249e52a2befb864"}}}}