{"action":"created","comment":{"url":"https://api.github.com/repos/endless-sky/endless-sky/pulls/comments/127347071","pull_request_review_id":49923624,"id":127347071,"diff_hunk":"@@ -169,31 +169,17 @@ const Color &Government::GetColor() const\n \n \n // Get the government's tribute-related hails\n-const Phrase *Government::GetTributeHail(int condition)\n+const Phrase *Government::GetTributeHail(int condition) const\n {\n-\tswitch(condition)\n-\t{\n-\t\tcase 1:\n-\t\t{\n-\t\t\treturn tributePresentHail;\n-\t\t}\n-\t\tcase 2:\n-\t\t{\n-\t\t\treturn tributeIgnoredHail;\n-\t\t}\n-\t\tcase 3:\n-\t\t{\n-\t\t\treturn tributeCombatHail;\n-\t\t}\n-\t\tcase 4:\n-\t\t{\n-\t\t\treturn tributeInProgressHail;\n-\t\t}\n-\t\tdefault:\n-\t\t{\n-\t\t\treturn tributeSurrenderedHail;\n-\t\t}\n-\t}\n+\tstatic const vector<const Phrase *> phrases = {\n+\ttributePresentHail,\n+\ttributeIgnoredHail,\n+\ttributeInProgressHail,\n+\ttributeCombatHail,\n+\ttributeSurrenderedHail\n+\t};\n+\t\n+\treturn phrases[condition];","path":"source/Government.cpp","position":52,"original_position":38,"commit_id":"764d254206c34d46a9a23d8d0aff07019808ac86","original_commit_id":"764d254206c34d46a9a23d8d0aff07019808ac86","user":{"login":"tehhowch","id":20871346,"avatar_url":"https://avatars0.githubusercontent.com/u/20871346?v=3","gravatar_id":"","url":"https://api.github.com/users/tehhowch","html_url":"https://github.com/tehhowch","followers_url":"https://api.github.com/users/tehhowch/followers","following_url":"https://api.github.com/users/tehhowch/following{/other_user}","gists_url":"https://api.github.com/users/tehhowch/gists{/gist_id}","starred_url":"https://api.github.com/users/tehhowch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tehhowch/subscriptions","organizations_url":"https://api.github.com/users/tehhowch/orgs","repos_url":"https://api.github.com/users/tehhowch/repos","events_url":"https://api.github.com/users/tehhowch/events{/privacy}","received_events_url":"https://api.github.com/users/tehhowch/received_events","type":"User","site_admin":false},"body":"could you make this `return phrases[condition]->Get()`? then you change it to a std::string return value, and position it in the `.h` and `.cpp` right next to Government::GetHail() for supreme logical consistency :1st_place_medal: \r\n\r\nYou may also want bounds checking on the input, though in your current code there's no variable inputs to this functions caller so you are pretty secure in knowing you are in-bounds.","created_at":"2017-07-13T22:23:37Z","updated_at":"2017-07-13T22:23:38Z","html_url":"https://github.com/endless-sky/endless-sky/pull/2758#discussion_r127347071","pull_request_url":"https://api.github.com/repos/endless-sky/endless-sky/pulls/2758","_links":{"self":{"href":"https://api.github.com/repos/endless-sky/endless-sky/pulls/comments/127347071"},"html":{"href":"https://github.com/endless-sky/endless-sky/pull/2758#discussion_r127347071"},"pull_request":{"href":"https://api.github.com/repos/endless-sky/endless-sky/pulls/2758"}}},"pull_request":{"url":"https://api.github.com/repos/endless-sky/endless-sky/pulls/2758","id":130455631,"html_url":"https://github.com/endless-sky/endless-sky/pull/2758","diff_url":"https://github.com/endless-sky/endless-sky/pull/2758.diff","patch_url":"https://github.com/endless-sky/endless-sky/pull/2758.patch","issue_url":"https://api.github.com/repos/endless-sky/endless-sky/issues/2758","number":2758,"state":"open","locked":false,"title":"Add support for custom \"demand tribute\" messages","user":{"login":"Hadron1776","id":24595528,"avatar_url":"https://avatars0.githubusercontent.com/u/24595528?v=3","gravatar_id":"","url":"https://api.github.com/users/Hadron1776","html_url":"https://github.com/Hadron1776","followers_url":"https://api.github.com/users/Hadron1776/followers","following_url":"https://api.github.com/users/Hadron1776/following{/other_user}","gists_url":"https://api.github.com/users/Hadron1776/gists{/gist_id}","starred_url":"https://api.github.com/users/Hadron1776/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hadron1776/subscriptions","organizations_url":"https://api.github.com/users/Hadron1776/orgs","repos_url":"https://api.github.com/users/Hadron1776/repos","events_url":"https://api.github.com/users/Hadron1776/events{/privacy}","received_events_url":"https://api.github.com/users/Hadron1776/received_events","type":"User","site_admin":false},"body":"This allows modders to override the various messages a planet gives when you demand tribute:\r\n`tribute denied hail` -> You demand tribute from a planet when your CR isn't high enough\r\n`tribute present hail` -> You demand tribute from a planet which is already paying you tribute\r\n`tribute in progress hail` -> You demand tribute when you're in the middle of fighting the defense fleet\r\n`tribute accepted hail` -> The planet takes your demand for tribute seriously and sends its defense fleet\r\n`tribute granted hail` -> The planet surrenders and (hopefully) tells you how many credits you'll be getting\r\n\r\nYou can use these tokens:\r\n`<tribute>` -> shows up as \" (_whatever the planet's tribute payment is_) credits\"\r\n`<first>` -> The player's first name\r\n`<last>` -> The player's last name\r\n`<origin>` -> The planet you're demanding tribute from\r\n`<ship>` -> The name of the player's flagship\r\n\r\nEdit: Forgot to mention that these are defined per government. If these hails are left out, they get default values.","created_at":"2017-07-13T20:05:34Z","updated_at":"2017-07-13T22:23:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ff2247810d5b01cc98f32dc7fc003eba3c3eb768","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/endless-sky/endless-sky/pulls/2758/commits","review_comments_url":"https://api.github.com/repos/endless-sky/endless-sky/pulls/2758/comments","review_comment_url":"https://api.github.com/repos/endless-sky/endless-sky/pulls/comments{/number}","comments_url":"https://api.github.com/repos/endless-sky/endless-sky/issues/2758/comments","statuses_url":"https://api.github.com/repos/endless-sky/endless-sky/statuses/764d254206c34d46a9a23d8d0aff07019808ac86","head":{"label":"Hadron1776:tribute-alterations","ref":"tribute-alterations","sha":"764d254206c34d46a9a23d8d0aff07019808ac86","user":{"login":"Hadron1776","id":24595528,"avatar_url":"https://avatars0.githubusercontent.com/u/24595528?v=3","gravatar_id":"","url":"https://api.github.com/users/Hadron1776","html_url":"https://github.com/Hadron1776","followers_url":"https://api.github.com/users/Hadron1776/followers","following_url":"https://api.github.com/users/Hadron1776/following{/other_user}","gists_url":"https://api.github.com/users/Hadron1776/gists{/gist_id}","starred_url":"https://api.github.com/users/Hadron1776/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hadron1776/subscriptions","organizations_url":"https://api.github.com/users/Hadron1776/orgs","repos_url":"https://api.github.com/users/Hadron1776/repos","events_url":"https://api.github.com/users/Hadron1776/events{/privacy}","received_events_url":"https://api.github.com/users/Hadron1776/received_events","type":"User","site_admin":false},"repo":{"id":94134200,"name":"endless-sky","full_name":"Hadron1776/endless-sky","owner":{"login":"Hadron1776","id":24595528,"avatar_url":"https://avatars0.githubusercontent.com/u/24595528?v=3","gravatar_id":"","url":"https://api.github.com/users/Hadron1776","html_url":"https://github.com/Hadron1776","followers_url":"https://api.github.com/users/Hadron1776/followers","following_url":"https://api.github.com/users/Hadron1776/following{/other_user}","gists_url":"https://api.github.com/users/Hadron1776/gists{/gist_id}","starred_url":"https://api.github.com/users/Hadron1776/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hadron1776/subscriptions","organizations_url":"https://api.github.com/users/Hadron1776/orgs","repos_url":"https://api.github.com/users/Hadron1776/repos","events_url":"https://api.github.com/users/Hadron1776/events{/privacy}","received_events_url":"https://api.github.com/users/Hadron1776/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Hadron1776/endless-sky","description":"Space exploration, trading, and combat game.","fork":true,"url":"https://api.github.com/repos/Hadron1776/endless-sky","forks_url":"https://api.github.com/repos/Hadron1776/endless-sky/forks","keys_url":"https://api.github.com/repos/Hadron1776/endless-sky/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Hadron1776/endless-sky/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Hadron1776/endless-sky/teams","hooks_url":"https://api.github.com/repos/Hadron1776/endless-sky/hooks","issue_events_url":"https://api.github.com/repos/Hadron1776/endless-sky/issues/events{/number}","events_url":"https://api.github.com/repos/Hadron1776/endless-sky/events","assignees_url":"https://api.github.com/repos/Hadron1776/endless-sky/assignees{/user}","branches_url":"https://api.github.com/repos/Hadron1776/endless-sky/branches{/branch}","tags_url":"https://api.github.com/repos/Hadron1776/endless-sky/tags","blobs_url":"https://api.github.com/repos/Hadron1776/endless-sky/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Hadron1776/endless-sky/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Hadron1776/endless-sky/git/refs{/sha}","trees_url":"https://api.github.com/repos/Hadron1776/endless-sky/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Hadron1776/endless-sky/statuses/{sha}","languages_url":"https://api.github.com/repos/Hadron1776/endless-sky/languages","stargazers_url":"https://api.github.com/repos/Hadron1776/endless-sky/stargazers","contributors_url":"https://api.github.com/repos/Hadron1776/endless-sky/contributors","subscribers_url":"https://api.github.com/repos/Hadron1776/endless-sky/subscribers","subscription_url":"https://api.github.com/repos/Hadron1776/endless-sky/subscription","commits_url":"https://api.github.com/repos/Hadron1776/endless-sky/commits{/sha}","git_commits_url":"https://api.github.com/repos/Hadron1776/endless-sky/git/commits{/sha}","comments_url":"https://api.github.com/repos/Hadron1776/endless-sky/comments{/number}","issue_comment_url":"https://api.github.com/repos/Hadron1776/endless-sky/issues/comments{/number}","contents_url":"https://api.github.com/repos/Hadron1776/endless-sky/contents/{+path}","compare_url":"https://api.github.com/repos/Hadron1776/endless-sky/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Hadron1776/endless-sky/merges","archive_url":"https://api.github.com/repos/Hadron1776/endless-sky/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Hadron1776/endless-sky/downloads","issues_url":"https://api.github.com/repos/Hadron1776/endless-sky/issues{/number}","pulls_url":"https://api.github.com/repos/Hadron1776/endless-sky/pulls{/number}","milestones_url":"https://api.github.com/repos/Hadron1776/endless-sky/milestones{/number}","notifications_url":"https://api.github.com/repos/Hadron1776/endless-sky/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Hadron1776/endless-sky/labels{/name}","releases_url":"https://api.github.com/repos/Hadron1776/endless-sky/releases{/id}","deployments_url":"https://api.github.com/repos/Hadron1776/endless-sky/deployments","created_at":"2017-06-12T19:45:51Z","updated_at":"2017-06-12T19:45:55Z","pushed_at":"2017-07-13T22:12:37Z","git_url":"git://github.com/Hadron1776/endless-sky.git","ssh_url":"git@github.com:Hadron1776/endless-sky.git","clone_url":"https://github.com/Hadron1776/endless-sky.git","svn_url":"https://github.com/Hadron1776/endless-sky","homepage":"http://endless-sky.github.io/","size":118084,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":false,"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":"endless-sky:master","ref":"master","sha":"89259410371ab124580751c98fd1e332b35e6a58","user":{"login":"endless-sky","id":11450262,"avatar_url":"https://avatars1.githubusercontent.com/u/11450262?v=3","gravatar_id":"","url":"https://api.github.com/users/endless-sky","html_url":"https://github.com/endless-sky","followers_url":"https://api.github.com/users/endless-sky/followers","following_url":"https://api.github.com/users/endless-sky/following{/other_user}","gists_url":"https://api.github.com/users/endless-sky/gists{/gist_id}","starred_url":"https://api.github.com/users/endless-sky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/endless-sky/subscriptions","organizations_url":"https://api.github.com/users/endless-sky/orgs","repos_url":"https://api.github.com/users/endless-sky/repos","events_url":"https://api.github.com/users/endless-sky/events{/privacy}","received_events_url":"https://api.github.com/users/endless-sky/received_events","type":"User","site_admin":false},"repo":{"id":32231207,"name":"endless-sky","full_name":"endless-sky/endless-sky","owner":{"login":"endless-sky","id":11450262,"avatar_url":"https://avatars1.githubusercontent.com/u/11450262?v=3","gravatar_id":"","url":"https://api.github.com/users/endless-sky","html_url":"https://github.com/endless-sky","followers_url":"https://api.github.com/users/endless-sky/followers","following_url":"https://api.github.com/users/endless-sky/following{/other_user}","gists_url":"https://api.github.com/users/endless-sky/gists{/gist_id}","starred_url":"https://api.github.com/users/endless-sky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/endless-sky/subscriptions","organizations_url":"https://api.github.com/users/endless-sky/orgs","repos_url":"https://api.github.com/users/endless-sky/repos","events_url":"https://api.github.com/users/endless-sky/events{/privacy}","received_events_url":"https://api.github.com/users/endless-sky/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/endless-sky/endless-sky","description":"Space exploration, trading, and combat game.","fork":false,"url":"https://api.github.com/repos/endless-sky/endless-sky","forks_url":"https://api.github.com/repos/endless-sky/endless-sky/forks","keys_url":"https://api.github.com/repos/endless-sky/endless-sky/keys{/key_id}","collaborators_url":"https://api.github.com/repos/endless-sky/endless-sky/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/endless-sky/endless-sky/teams","hooks_url":"https://api.github.com/repos/endless-sky/endless-sky/hooks","issue_events_url":"https://api.github.com/repos/endless-sky/endless-sky/issues/events{/number}","events_url":"https://api.github.com/repos/endless-sky/endless-sky/events","assignees_url":"https://api.github.com/repos/endless-sky/endless-sky/assignees{/user}","branches_url":"https://api.github.com/repos/endless-sky/endless-sky/branches{/branch}","tags_url":"https://api.github.com/repos/endless-sky/endless-sky/tags","blobs_url":"https://api.github.com/repos/endless-sky/endless-sky/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/endless-sky/endless-sky/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/endless-sky/endless-sky/git/refs{/sha}","trees_url":"https://api.github.com/repos/endless-sky/endless-sky/git/trees{/sha}","statuses_url":"https://api.github.com/repos/endless-sky/endless-sky/statuses/{sha}","languages_url":"https://api.github.com/repos/endless-sky/endless-sky/languages","stargazers_url":"https://api.github.com/repos/endless-sky/endless-sky/stargazers","contributors_url":"https://api.github.com/repos/endless-sky/endless-sky/contributors","subscribers_url":"https://api.github.com/repos/endless-sky/endless-sky/subscribers","subscription_url":"https://api.github.com/repos/endless-sky/endless-sky/subscription","commits_url":"https://api.github.com/repos/endless-sky/endless-sky/commits{/sha}","git_commits_url":"https://api.github.com/repos/endless-sky/endless-sky/git/commits{/sha}","comments_url":"https://api.github.com/repos/endless-sky/endless-sky/comments{/number}","issue_comment_url":"https://api.github.com/repos/endless-sky/endless-sky/issues/comments{/number}","contents_url":"https://api.github.com/repos/endless-sky/endless-sky/contents/{+path}","compare_url":"https://api.github.com/repos/endless-sky/endless-sky/compare/{base}...{head}","merges_url":"https://api.github.com/repos/endless-sky/endless-sky/merges","archive_url":"https://api.github.com/repos/endless-sky/endless-sky/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/endless-sky/endless-sky/downloads","issues_url":"https://api.github.com/repos/endless-sky/endless-sky/issues{/number}","pulls_url":"https://api.github.com/repos/endless-sky/endless-sky/pulls{/number}","milestones_url":"https://api.github.com/repos/endless-sky/endless-sky/milestones{/number}","notifications_url":"https://api.github.com/repos/endless-sky/endless-sky/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/endless-sky/endless-sky/labels{/name}","releases_url":"https://api.github.com/repos/endless-sky/endless-sky/releases{/id}","deployments_url":"https://api.github.com/repos/endless-sky/endless-sky/deployments","created_at":"2015-03-14T20:44:39Z","updated_at":"2017-07-13T13:19:51Z","pushed_at":"2017-07-13T22:11:27Z","git_url":"git://github.com/endless-sky/endless-sky.git","ssh_url":"git@github.com:endless-sky/endless-sky.git","clone_url":"https://github.com/endless-sky/endless-sky.git","svn_url":"https://github.com/endless-sky/endless-sky","homepage":"http://endless-sky.github.io/","size":119181,"stargazers_count":1021,"watchers_count":1021,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":287,"mirror_url":null,"open_issues_count":464,"forks":287,"open_issues":464,"watchers":1021,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/endless-sky/endless-sky/pulls/2758"},"html":{"href":"https://github.com/endless-sky/endless-sky/pull/2758"},"issue":{"href":"https://api.github.com/repos/endless-sky/endless-sky/issues/2758"},"comments":{"href":"https://api.github.com/repos/endless-sky/endless-sky/issues/2758/comments"},"review_comments":{"href":"https://api.github.com/repos/endless-sky/endless-sky/pulls/2758/comments"},"review_comment":{"href":"https://api.github.com/repos/endless-sky/endless-sky/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/endless-sky/endless-sky/pulls/2758/commits"},"statuses":{"href":"https://api.github.com/repos/endless-sky/endless-sky/statuses/764d254206c34d46a9a23d8d0aff07019808ac86"}}}}
{"actor":{"display_login":"tehhowch"}}