{"action":"opened","number":235,"pull_request":{"url":"https://api.github.com/repos/OpenRCT2/OpenLoco/pulls/235","id":217774790,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE3Nzc0Nzkw","html_url":"https://github.com/OpenRCT2/OpenLoco/pull/235","diff_url":"https://github.com/OpenRCT2/OpenLoco/pull/235.diff","patch_url":"https://github.com/OpenRCT2/OpenLoco/pull/235.patch","issue_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/issues/235","number":235,"state":"open","locked":false,"title":"Refactor/reduce globals","user":{"login":"IntelOrca","id":1482259,"node_id":"MDQ6VXNlcjE0ODIyNTk=","avatar_url":"https://avatars3.githubusercontent.com/u/1482259?v=4","gravatar_id":"","url":"https://api.github.com/users/IntelOrca","html_url":"https://github.com/IntelOrca","followers_url":"https://api.github.com/users/IntelOrca/followers","following_url":"https://api.github.com/users/IntelOrca/following{/other_user}","gists_url":"https://api.github.com/users/IntelOrca/gists{/gist_id}","starred_url":"https://api.github.com/users/IntelOrca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IntelOrca/subscriptions","organizations_url":"https://api.github.com/users/IntelOrca/orgs","repos_url":"https://api.github.com/users/IntelOrca/repos","events_url":"https://api.github.com/users/IntelOrca/events{/privacy}","received_events_url":"https://api.github.com/users/IntelOrca/received_events","type":"User","site_admin":false},"body":"One of the problems we have with OpenRCT2 is the large number of global variables that we have. While global variables can be very convenient they are not good code practice and cause issues when they are auto disposed in the incorrect order.\r\n\r\nThis PR changes all services to be classes instead of methods in namespaces and passes the service instance to all the functions that require it. If a function needs a large number of services then I pass `context` instead which is sort of like a service provider. There are still a few `g_ctx` occurances about but this PR should give you more of an idea of what the code would look like.\r\n\r\nThe only annoying thing I see at the moment is methods like `vehicle->next()` which now requires passing the thing manager as a parameter as we ~~can not~~ should not store service references on game state objects.","created_at":"2018-09-24T20:15:25Z","updated_at":"2018-09-24T20:15:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/pulls/235/commits","review_comments_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/pulls/235/comments","review_comment_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/issues/235/comments","statuses_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/statuses/23989fc07b0ff6361cceb35e2587ce70dc6a2cf1","head":{"label":"IntelOrca:refactor/reduce-globals","ref":"refactor/reduce-globals","sha":"23989fc07b0ff6361cceb35e2587ce70dc6a2cf1","user":{"login":"IntelOrca","id":1482259,"node_id":"MDQ6VXNlcjE0ODIyNTk=","avatar_url":"https://avatars3.githubusercontent.com/u/1482259?v=4","gravatar_id":"","url":"https://api.github.com/users/IntelOrca","html_url":"https://github.com/IntelOrca","followers_url":"https://api.github.com/users/IntelOrca/followers","following_url":"https://api.github.com/users/IntelOrca/following{/other_user}","gists_url":"https://api.github.com/users/IntelOrca/gists{/gist_id}","starred_url":"https://api.github.com/users/IntelOrca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IntelOrca/subscriptions","organizations_url":"https://api.github.com/users/IntelOrca/orgs","repos_url":"https://api.github.com/users/IntelOrca/repos","events_url":"https://api.github.com/users/IntelOrca/events{/privacy}","received_events_url":"https://api.github.com/users/IntelOrca/received_events","type":"User","site_admin":false},"repo":{"id":118798150,"node_id":"MDEwOlJlcG9zaXRvcnkxMTg3OTgxNTA=","name":"OpenLoco","full_name":"IntelOrca/OpenLoco","private":false,"owner":{"login":"IntelOrca","id":1482259,"node_id":"MDQ6VXNlcjE0ODIyNTk=","avatar_url":"https://avatars3.githubusercontent.com/u/1482259?v=4","gravatar_id":"","url":"https://api.github.com/users/IntelOrca","html_url":"https://github.com/IntelOrca","followers_url":"https://api.github.com/users/IntelOrca/followers","following_url":"https://api.github.com/users/IntelOrca/following{/other_user}","gists_url":"https://api.github.com/users/IntelOrca/gists{/gist_id}","starred_url":"https://api.github.com/users/IntelOrca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IntelOrca/subscriptions","organizations_url":"https://api.github.com/users/IntelOrca/orgs","repos_url":"https://api.github.com/users/IntelOrca/repos","events_url":"https://api.github.com/users/IntelOrca/events{/privacy}","received_events_url":"https://api.github.com/users/IntelOrca/received_events","type":"User","site_admin":false},"html_url":"https://github.com/IntelOrca/OpenLoco","description":"An open source re-implementation of Chris Sawyer's Locomotion","fork":true,"url":"https://api.github.com/repos/IntelOrca/OpenLoco","forks_url":"https://api.github.com/repos/IntelOrca/OpenLoco/forks","keys_url":"https://api.github.com/repos/IntelOrca/OpenLoco/keys{/key_id}","collaborators_url":"https://api.github.com/repos/IntelOrca/OpenLoco/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/IntelOrca/OpenLoco/teams","hooks_url":"https://api.github.com/repos/IntelOrca/OpenLoco/hooks","issue_events_url":"https://api.github.com/repos/IntelOrca/OpenLoco/issues/events{/number}","events_url":"https://api.github.com/repos/IntelOrca/OpenLoco/events","assignees_url":"https://api.github.com/repos/IntelOrca/OpenLoco/assignees{/user}","branches_url":"https://api.github.com/repos/IntelOrca/OpenLoco/branches{/branch}","tags_url":"https://api.github.com/repos/IntelOrca/OpenLoco/tags","blobs_url":"https://api.github.com/repos/IntelOrca/OpenLoco/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/IntelOrca/OpenLoco/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/IntelOrca/OpenLoco/git/refs{/sha}","trees_url":"https://api.github.com/repos/IntelOrca/OpenLoco/git/trees{/sha}","statuses_url":"https://api.github.com/repos/IntelOrca/OpenLoco/statuses/{sha}","languages_url":"https://api.github.com/repos/IntelOrca/OpenLoco/languages","stargazers_url":"https://api.github.com/repos/IntelOrca/OpenLoco/stargazers","contributors_url":"https://api.github.com/repos/IntelOrca/OpenLoco/contributors","subscribers_url":"https://api.github.com/repos/IntelOrca/OpenLoco/subscribers","subscription_url":"https://api.github.com/repos/IntelOrca/OpenLoco/subscription","commits_url":"https://api.github.com/repos/IntelOrca/OpenLoco/commits{/sha}","git_commits_url":"https://api.github.com/repos/IntelOrca/OpenLoco/git/commits{/sha}","comments_url":"https://api.github.com/repos/IntelOrca/OpenLoco/comments{/number}","issue_comment_url":"https://api.github.com/repos/IntelOrca/OpenLoco/issues/comments{/number}","contents_url":"https://api.github.com/repos/IntelOrca/OpenLoco/contents/{+path}","compare_url":"https://api.github.com/repos/IntelOrca/OpenLoco/compare/{base}...{head}","merges_url":"https://api.github.com/repos/IntelOrca/OpenLoco/merges","archive_url":"https://api.github.com/repos/IntelOrca/OpenLoco/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/IntelOrca/OpenLoco/downloads","issues_url":"https://api.github.com/repos/IntelOrca/OpenLoco/issues{/number}","pulls_url":"https://api.github.com/repos/IntelOrca/OpenLoco/pulls{/number}","milestones_url":"https://api.github.com/repos/IntelOrca/OpenLoco/milestones{/number}","notifications_url":"https://api.github.com/repos/IntelOrca/OpenLoco/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/IntelOrca/OpenLoco/labels{/name}","releases_url":"https://api.github.com/repos/IntelOrca/OpenLoco/releases{/id}","deployments_url":"https://api.github.com/repos/IntelOrca/OpenLoco/deployments","created_at":"2018-01-24T17:27:01Z","updated_at":"2018-01-24T17:27:03Z","pushed_at":"2018-09-22T22:27:04Z","git_url":"git://github.com/IntelOrca/OpenLoco.git","ssh_url":"git@github.com:IntelOrca/OpenLoco.git","clone_url":"https://github.com/IntelOrca/OpenLoco.git","svn_url":"https://github.com/IntelOrca/OpenLoco","homepage":null,"size":2820,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"OpenRCT2:master","ref":"master","sha":"15a1844773f9fecacce24e874918de957b282d03","user":{"login":"OpenRCT2","id":8473908,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg0NzM5MDg=","avatar_url":"https://avatars0.githubusercontent.com/u/8473908?v=4","gravatar_id":"","url":"https://api.github.com/users/OpenRCT2","html_url":"https://github.com/OpenRCT2","followers_url":"https://api.github.com/users/OpenRCT2/followers","following_url":"https://api.github.com/users/OpenRCT2/following{/other_user}","gists_url":"https://api.github.com/users/OpenRCT2/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenRCT2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenRCT2/subscriptions","organizations_url":"https://api.github.com/users/OpenRCT2/orgs","repos_url":"https://api.github.com/users/OpenRCT2/repos","events_url":"https://api.github.com/users/OpenRCT2/events{/privacy}","received_events_url":"https://api.github.com/users/OpenRCT2/received_events","type":"Organization","site_admin":false},"repo":{"id":116523281,"node_id":"MDEwOlJlcG9zaXRvcnkxMTY1MjMyODE=","name":"OpenLoco","full_name":"OpenRCT2/OpenLoco","private":false,"owner":{"login":"OpenRCT2","id":8473908,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg0NzM5MDg=","avatar_url":"https://avatars0.githubusercontent.com/u/8473908?v=4","gravatar_id":"","url":"https://api.github.com/users/OpenRCT2","html_url":"https://github.com/OpenRCT2","followers_url":"https://api.github.com/users/OpenRCT2/followers","following_url":"https://api.github.com/users/OpenRCT2/following{/other_user}","gists_url":"https://api.github.com/users/OpenRCT2/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenRCT2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenRCT2/subscriptions","organizations_url":"https://api.github.com/users/OpenRCT2/orgs","repos_url":"https://api.github.com/users/OpenRCT2/repos","events_url":"https://api.github.com/users/OpenRCT2/events{/privacy}","received_events_url":"https://api.github.com/users/OpenRCT2/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/OpenRCT2/OpenLoco","description":"An open source re-implementation of Chris Sawyer's Locomotion","fork":false,"url":"https://api.github.com/repos/OpenRCT2/OpenLoco","forks_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/forks","keys_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/teams","hooks_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/hooks","issue_events_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/issues/events{/number}","events_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/events","assignees_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/assignees{/user}","branches_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/branches{/branch}","tags_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/tags","blobs_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/git/refs{/sha}","trees_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/statuses/{sha}","languages_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/languages","stargazers_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/stargazers","contributors_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/contributors","subscribers_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/subscribers","subscription_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/subscription","commits_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/commits{/sha}","git_commits_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/git/commits{/sha}","comments_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/comments{/number}","issue_comment_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/issues/comments{/number}","contents_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/contents/{+path}","compare_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/merges","archive_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/downloads","issues_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/issues{/number}","pulls_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/pulls{/number}","milestones_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/milestones{/number}","notifications_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/labels{/name}","releases_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/releases{/id}","deployments_url":"https://api.github.com/repos/OpenRCT2/OpenLoco/deployments","created_at":"2018-01-06T23:35:23Z","updated_at":"2018-09-24T19:19:51Z","pushed_at":"2018-09-24T14:42:11Z","git_url":"git://github.com/OpenRCT2/OpenLoco.git","ssh_url":"git@github.com:OpenRCT2/OpenLoco.git","clone_url":"https://github.com/OpenRCT2/OpenLoco.git","svn_url":"https://github.com/OpenRCT2/OpenLoco","homepage":null,"size":3182,"stargazers_count":142,"watchers_count":142,"language":"C++","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":31,"mirror_url":null,"archived":false,"open_issues_count":92,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":31,"open_issues":92,"watchers":142,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/OpenRCT2/OpenLoco/pulls/235"},"html":{"href":"https://github.com/OpenRCT2/OpenLoco/pull/235"},"issue":{"href":"https://api.github.com/repos/OpenRCT2/OpenLoco/issues/235"},"comments":{"href":"https://api.github.com/repos/OpenRCT2/OpenLoco/issues/235/comments"},"review_comments":{"href":"https://api.github.com/repos/OpenRCT2/OpenLoco/pulls/235/comments"},"review_comment":{"href":"https://api.github.com/repos/OpenRCT2/OpenLoco/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OpenRCT2/OpenLoco/pulls/235/commits"},"statuses":{"href":"https://api.github.com/repos/OpenRCT2/OpenLoco/statuses/23989fc07b0ff6361cceb35e2587ce70dc6a2cf1"}},"author_association":"COLLABORATOR","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":true,"commits":46,"additions":3604,"deletions":1922,"changed_files":82}}
{"actor":{"display_login":"IntelOrca"}}