{"pull_request":{"state":"closed","deletions":30,"merged_by":{"avatar_url":"https://secure.gravatar.com/avatar/e0111ec54e2ff06c4661eda1a0585f9f?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"e0111ec54e2ff06c4661eda1a0585f9f","url":"https://api.github.com/users/robn","login":"robn","id":130670},"user":{"avatar_url":"https://secure.gravatar.com/avatar/c743b5f7b5d7130c0f5b74a956ba6490?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"c743b5f7b5d7130c0f5b74a956ba6490","url":"https://api.github.com/users/johnbartholomew","login":"johnbartholomew","id":115749},"updated_at":"2011-11-14T08:45:12Z","closed_at":"2011-11-14T08:45:12Z","commits":9,"comments":0,"base":{"ref":"master","user":{"avatar_url":"https://secure.gravatar.com/avatar/0e33109a8fba33cbf66e04a5f63428c3?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png","gravatar_id":"0e33109a8fba33cbf66e04a5f63428c3","url":"https://api.github.com/users/pioneerspacesim","login":"pioneerspacesim","id":719820},"repo":{"name":"pioneer","pushed_at":"2011-11-14T08:45:08Z","fork":false,"master_branch":null,"updated_at":"2011-11-14T08:45:08Z","clone_url":"https://github.com/pioneerspacesim/pioneer.git","homepage":"http://pioneerspacesim.net/","open_issues":164,"language":"C","private":false,"forks":33,"svn_url":"https://svn.github.com/pioneerspacesim/pioneer","url":"https://api.github.com/repos/pioneerspacesim/pioneer","owner":{"avatar_url":"https://secure.gravatar.com/avatar/0e33109a8fba33cbf66e04a5f63428c3?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png","gravatar_id":"0e33109a8fba33cbf66e04a5f63428c3","url":"https://api.github.com/users/pioneerspacesim","login":"pioneerspacesim","id":719820},"html_url":"https://github.com/pioneerspacesim/pioneer","description":"space simulation adventure game","size":3924,"id":1593053,"git_url":"git://github.com/pioneerspacesim/pioneer.git","watchers":48,"created_at":"2011-04-09T22:17:05Z","ssh_url":"git@github.com:pioneerspacesim/pioneer.git"},"label":"pioneerspacesim:master","sha":"0628c47f44c2cf7ad73d75c88932e140e1f5fb47"},"diff_url":"https://github.com/pioneerspacesim/pioneer/pull/795.diff","head":{"ref":"systempath","user":{"avatar_url":"https://secure.gravatar.com/avatar/c743b5f7b5d7130c0f5b74a956ba6490?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"c743b5f7b5d7130c0f5b74a956ba6490","url":"https://api.github.com/users/johnbartholomew","login":"johnbartholomew","id":115749},"repo":{"name":"pioneer","pushed_at":"2011-11-14T06:57:50Z","fork":true,"master_branch":null,"updated_at":"2011-11-14T06:57:50Z","clone_url":"https://github.com/johnbartholomew/pioneer.git","homepage":"http://pioneerspacesim.net/","open_issues":9,"language":"C","private":false,"forks":0,"svn_url":"https://svn.github.com/johnbartholomew/pioneer","url":"https://api.github.com/repos/johnbartholomew/pioneer","owner":{"avatar_url":"https://secure.gravatar.com/avatar/c743b5f7b5d7130c0f5b74a956ba6490?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"c743b5f7b5d7130c0f5b74a956ba6490","url":"https://api.github.com/users/johnbartholomew","login":"johnbartholomew","id":115749},"html_url":"https://github.com/johnbartholomew/pioneer","description":"space simulation adventure game","size":148,"id":1028383,"git_url":"git://github.com/johnbartholomew/pioneer.git","watchers":1,"created_at":"2010-10-27T11:17:20Z","ssh_url":"git@github.com:johnbartholomew/pioneer.git"},"label":"johnbartholomew:systempath","sha":"57f28070e1625a393fdf090c8bdb34a6c8bebe15"},"additions":177,"url":"https://api.github.com/repos/pioneerspacesim/pioneer/pulls/795","merged":true,"body":"SystemPath can, and does, point to a whole sector, or to a system, or to a body within a system. However, this was purely implicit in which values happened to be used. This meant that there was no difference between a SystemPath that had been constructed to point to, say, Sector 0,0,0, and a SystemPath that had been constructed to point to the star, \"Sol\".\r\n\r\nFollowing the general guideline that invalid data should be trapped as early as possible, this patch series alters SystemPath so that -1 is used as an explicit 'invalid' value for the `systemIndex` and `bodyIndex` fields.\r\n\r\nChanges:\r\n\r\n* When Lua accesses the `systemIndex` or `bodyIndex` attributes, 'nil' is returned if the field is invalid.\r\n* SystemPath gets an extra constructor that takes just sector X,Y,Z and sets the system and body index fields to -1.\r\n* SystemPath gets an extra set of methods for checking which fields are valid and clearing unwanted fields: `IsSectorPath`, `IsSystemPath`, `IsBodyPath` return a bool indicating whether the SystemPath is of the relevant form (this is an exact test, not a sub-typing test; that is, e.g., `IsSystemPath` returns false if the path contains valid body and system indices). `SectorOnly` and `SystemOnly` return a copy of the SystemPath with the extraneous fields cleared to -1. `IsSameSector` compares for equality against another SystemPath, checking only the sector X,Y,Z fields.\r\n* `SectorOnly`, `SystemOnly` and `IsSameSector` are exposed to Lua.\r\n* The Lua SystemPath type gains a `__tostring` metamethod. This is automatically used by the `print()` and `tostring()` functions.\r\n* Various other bits of code has been updated to work with the new requirements or to use the new SystemPath methods.\r\n* As part of the work for this I had to fix a long-standing bug in the way SectorView is initialised.\r\n\r\nUnfortunately, this change is the sort that can easily introduce subtle bugs. It could do with being looked at by fresh eyes.","merged_at":"2011-11-14T08:45:12Z","_links":{"comments":{"href":"https://api.github.com/repos/pioneerspacesim/pioneer/issues/795/comments"},"html":{"href":"https://github.com/pioneerspacesim/pioneer/pull/795"},"review_comments":{"href":"https://api.github.com/repos/pioneerspacesim/pioneer/pulls/795/comments"},"self":{"href":"https://api.github.com/repos/pioneerspacesim/pioneer/pulls/795"}},"review_comments":0,"html_url":"https://github.com/pioneerspacesim/pioneer/pull/795","issue_url":"https://github.com/pioneerspacesim/pioneer/issues/795","title":"Use -1 as an explicitly invalid systemIndex and bodyIndex in SystemPath","number":795,"mergeable":null,"id":490513,"patch_url":"https://github.com/pioneerspacesim/pioneer/pull/795.patch","changed_files":8,"created_at":"2011-11-14T03:52:31Z"},"action":"closed","number":795}