{"action":"opened","number":13285,"pull_request":{"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/13285","id":42456140,"html_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/13285","diff_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/13285.diff","patch_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/13285.patch","issue_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/13285","number":13285,"state":"open","locked":false,"title":"Fix Bresenham for 3D","user":{"login":"BevapDin","id":5095435,"avatar_url":"https://avatars.githubusercontent.com/u/5095435?v=3","gravatar_id":"","url":"https://api.github.com/users/BevapDin","html_url":"https://github.com/BevapDin","followers_url":"https://api.github.com/users/BevapDin/followers","following_url":"https://api.github.com/users/BevapDin/following{/other_user}","gists_url":"https://api.github.com/users/BevapDin/gists{/gist_id}","starred_url":"https://api.github.com/users/BevapDin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BevapDin/subscriptions","organizations_url":"https://api.github.com/users/BevapDin/orgs","repos_url":"https://api.github.com/users/BevapDin/repos","events_url":"https://api.github.com/users/BevapDin/events{/privacy}","received_events_url":"https://api.github.com/users/BevapDin/received_events","type":"User","site_admin":false},"body":"Fixes #13273. Thanks to @drbig for pointing it out.\r\n\r\n----\r\n\r\nI used a test program https://gist.github.com/BevapDin/bbfa3e8ed23d5b8ba698 (warning: it runs in an effectively infinite loop, you have to kill the program manually) that calls the function with random points as input and checks the maximal number of iterations, the incremental difference and the final point. The test program fails as expected with the original code: once because some iteration move 2 z-levels at once (`cur.z` being incremented twice) and once for two many iterations.\r\n\r\nA note: If `bresenham` is called with `t2 == 0`, the function very often fails to iterator over the last point (the callback is not called with a point equal to the end point). Considering that this is the default when invoked via the 3D version of `line_to`, it seems problematic, callers very much expect the end point to be contained in the result. Maybe change the default to `1`?","created_at":"2015-08-14T13:35:45Z","updated_at":"2015-08-14T13:35:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/13285/commits","review_comments_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/13285/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/13285/comments","statuses_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/statuses/690599d2e39d0b0dcddaf6858a882f563d1b781a","head":{"label":"BevapDin:jia","ref":"jia","sha":"690599d2e39d0b0dcddaf6858a882f563d1b781a","user":{"login":"BevapDin","id":5095435,"avatar_url":"https://avatars.githubusercontent.com/u/5095435?v=3","gravatar_id":"","url":"https://api.github.com/users/BevapDin","html_url":"https://github.com/BevapDin","followers_url":"https://api.github.com/users/BevapDin/followers","following_url":"https://api.github.com/users/BevapDin/following{/other_user}","gists_url":"https://api.github.com/users/BevapDin/gists{/gist_id}","starred_url":"https://api.github.com/users/BevapDin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BevapDin/subscriptions","organizations_url":"https://api.github.com/users/BevapDin/orgs","repos_url":"https://api.github.com/users/BevapDin/repos","events_url":"https://api.github.com/users/BevapDin/events{/privacy}","received_events_url":"https://api.github.com/users/BevapDin/received_events","type":"User","site_admin":false},"repo":{"id":11775770,"name":"Cataclysm-DDA","full_name":"BevapDin/Cataclysm-DDA","owner":{"login":"BevapDin","id":5095435,"avatar_url":"https://avatars.githubusercontent.com/u/5095435?v=3","gravatar_id":"","url":"https://api.github.com/users/BevapDin","html_url":"https://github.com/BevapDin","followers_url":"https://api.github.com/users/BevapDin/followers","following_url":"https://api.github.com/users/BevapDin/following{/other_user}","gists_url":"https://api.github.com/users/BevapDin/gists{/gist_id}","starred_url":"https://api.github.com/users/BevapDin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BevapDin/subscriptions","organizations_url":"https://api.github.com/users/BevapDin/orgs","repos_url":"https://api.github.com/users/BevapDin/repos","events_url":"https://api.github.com/users/BevapDin/events{/privacy}","received_events_url":"https://api.github.com/users/BevapDin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/BevapDin/Cataclysm-DDA","description":"Cataclysm - Dark Days Ahead. A fork/variant of Cataclysm Roguelike by Whales.","fork":true,"url":"https://api.github.com/repos/BevapDin/Cataclysm-DDA","forks_url":"https://api.github.com/repos/BevapDin/Cataclysm-DDA/forks","keys_url":"https://api.github.com/repos/BevapDin/Cataclysm-DDA/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BevapDin/Cataclysm-DDA/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BevapDin/Cataclysm-DDA/teams","hooks_url":"https://api.github.com/repos/BevapDin/Cataclysm-DDA/hooks","issue_events_url":"https://api.github.com/repos/BevapDin/Cataclysm-DDA/issues/events{/number}","events_url":"https://api.github.com/repos/BevapDin/Cataclysm-DDA/events","assignees_url":"https://api.github.com/repos/BevapDin/Cataclysm-DDA/assignees{/user}","branches_url":"https://api.github.com/repos/BevapDin/Cataclysm-DDA/branches{/branch}","tags_url":"https://api.github.com/repos/BevapDin/Cataclysm-DDA/tags","blobs_url":"https://api.github.com/repos/BevapDin/Cataclysm-DDA/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BevapDin/Cataclysm-DDA/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BevapDin/Cataclysm-DDA/git/refs{/sha}","trees_url":"https://api.github.com/repos/BevapDin/Cataclysm-DDA/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BevapDin/Cataclysm-DDA/statuses/{sha}","languages_url":"https://api.github.com/repos/BevapDin/Cataclysm-DDA/languages","stargazers_url":"https://api.github.com/repos/BevapDin/Cataclysm-DDA/stargazers","contributors_url":"https://api.github.com/repos/BevapDin/Cataclysm-DDA/contributors","subscribers_url":"https://api.github.com/repos/BevapDin/Cataclysm-DDA/subscribers","subscription_url":"https://api.github.com/repos/BevapDin/Cataclysm-DDA/subscription","commits_url":"https://api.github.com/repos/BevapDin/Cataclysm-DDA/commits{/sha}","git_commits_url":"https://api.github.com/repos/BevapDin/Cataclysm-DDA/git/commits{/sha}","comments_url":"https://api.github.com/repos/BevapDin/Cataclysm-DDA/comments{/number}","issue_comment_url":"https://api.github.com/repos/BevapDin/Cataclysm-DDA/issues/comments{/number}","contents_url":"https://api.github.com/repos/BevapDin/Cataclysm-DDA/contents/{+path}","compare_url":"https://api.github.com/repos/BevapDin/Cataclysm-DDA/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BevapDin/Cataclysm-DDA/merges","archive_url":"https://api.github.com/repos/BevapDin/Cataclysm-DDA/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BevapDin/Cataclysm-DDA/downloads","issues_url":"https://api.github.com/repos/BevapDin/Cataclysm-DDA/issues{/number}","pulls_url":"https://api.github.com/repos/BevapDin/Cataclysm-DDA/pulls{/number}","milestones_url":"https://api.github.com/repos/BevapDin/Cataclysm-DDA/milestones{/number}","notifications_url":"https://api.github.com/repos/BevapDin/Cataclysm-DDA/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BevapDin/Cataclysm-DDA/labels{/name}","releases_url":"https://api.github.com/repos/BevapDin/Cataclysm-DDA/releases{/id}","created_at":"2013-07-30T21:12:59Z","updated_at":"2015-04-22T16:20:34Z","pushed_at":"2015-08-14T13:10:58Z","git_url":"git://github.com/BevapDin/Cataclysm-DDA.git","ssh_url":"git@github.com:BevapDin/Cataclysm-DDA.git","clone_url":"https://github.com/BevapDin/Cataclysm-DDA.git","svn_url":"https://github.com/BevapDin/Cataclysm-DDA","homepage":"http://en.cataclysmdda.com/","size":505747,"stargazers_count":1,"watchers_count":1,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"67a07ee6fe4c196d6cad045aeeca13a83f6254be","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-12T09:45:38Z","pushed_at":"2015-08-14T13:05:05Z","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":791913,"stargazers_count":717,"watchers_count":717,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":753,"mirror_url":null,"open_issues_count":1039,"forks":753,"open_issues":1039,"watchers":717,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/13285"},"html":{"href":"https://github.com/CleverRaven/Cataclysm-DDA/pull/13285"},"issue":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/13285"},"comments":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/13285/comments"},"review_comments":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/13285/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/13285/commits"},"statuses":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/statuses/690599d2e39d0b0dcddaf6858a882f563d1b781a"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":2,"additions":3,"deletions":3,"changed_files":1}}